Skip to content

Commit

Permalink
Upgrade react-app-rewired to 2.0.1
Browse files Browse the repository at this point in the history
Avoid issue yarnpkg/yarn#6300

Signed-off-by: Joe Farro <[email protected]>
  • Loading branch information
tiffon committed Jan 7, 2019
1 parent 625883a commit 9ec38d5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 61 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
"flow": "glow",
"lint": "yarn run prettier-lint && yarn run eslint && yarn run flow && yarn run check-license",
"prepare": "lerna run --stream --sort prepublishOnly",
"prettier-comment": "https://github.com/yarnpkg/yarn/issues/6300",
"prettier":
"prettier --write '{.,scripts}/*.{js,json,md}' 'packages/*/{src,demo/src}/**/!(react-vis).{css,js,json,md}' 'packages/*/*.{css,js,json,md}'",
"./node_modules/prettier/bin-prettier.js --write '{.,scripts}/*.{js,json,md}' 'packages/*/{src,demo/src}/**/!(react-vis).{css,js,json,md}' 'packages/*/*.{css,js,json,md}'",
"prettier-lint":
"prettier --list-different '{.,scripts}/*.{js,json,md}' 'packages/*/{src,demo/src}/**/!(react-vis).{css,js,json,md}' 'packages/*/*.{css,js,json,md}'",
"./node_modules/prettier/bin-prettier.js --list-different '{.,scripts}/*.{js,json,md}' 'packages/*/{src,demo/src}/**/!(react-vis).{css,js,json,md}' 'packages/*/*.{css,js,json,md}'",
"test": "lerna run test",
"start": "cd packages/jaeger-ui && yarn start"
},
Expand Down
36 changes: 10 additions & 26 deletions packages/jaeger-ui/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@

/* eslint-disable import/no-extraneous-dependencies */
const fs = require('fs');
const { injectBabelPlugin } = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');
const { addBabelPlugin, addLessLoader } = require('customize-cra');
const lessToJs = require('less-vars-to-js');

// Convert less vars to JS
const loadedVarOverrides = fs.readFileSync('config-overrides-antd-vars.less', 'utf8');
const modifyVars = lessToJs(loadedVarOverrides);

function useEslintRc(config) {
const { rules } = config.module;
const preRule = rules.find(rule => rule.enforce === 'pre');
Expand All @@ -40,30 +35,19 @@ function useEslintRc(config) {
return config;
}

function webpack(_config, env) {
// Convert less vars to JS
const loadedVarOverrides = fs.readFileSync('config-overrides-antd-vars.less', 'utf8');
const modifyVars = lessToJs(loadedVarOverrides);

function webpack(_config) {
let config = _config;
config = rewireLess.withLoaderOptions({
config = addLessLoader({
modifyVars,
javascriptEnabled: true,
})(config, env);
config = injectBabelPlugin(
['import', { libraryName: 'antd', style: true, libraryDirectory: 'lib' }],
config
);
})(config);
config = addBabelPlugin(['import', { libraryName: 'antd', style: true, libraryDirectory: 'lib' }])(config);
useEslintRc(config);
return config;
}

// Don't use react-app-rewired/scripts/utils/babelTransform.js for the jest
// transform - it has an issue with automatically loading decorators.
function jest(config) {
const _config = config;
Object.keys(_config.transform).forEach(key => {
if (_config.transform[key].endsWith('babelTransform.js')) {
_config.transform[key] = require.resolve('./jest-babel-transform.js');
}
});
return config;
}

module.exports = { jest, webpack };
module.exports = { webpack };
23 changes: 0 additions & 23 deletions packages/jaeger-ui/jest-babel-transform.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/jaeger-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"devDependencies": {
"babel-plugin-import": "1.11.0",
"bluebird": "^3.5.0",
"customize-cra": "0.2.9",
"enzyme": "^3.2.0",
"enzyme-adapter-react-16": "^1.1.0",
"enzyme-to-json": "^3.3.0",
"http-proxy-middleware": "^0.19.1",
"less-vars-to-js": "^1.2.1",
"react-app-rewire-less": "2.1.3",
"react-app-rewired": "2.0.2-next.0",
"react-app-rewired": "2.0.1",
"react-scripts": "2.1.2",
"react-test-renderer": "^15.6.1",
"sinon": "^3.2.1",
Expand Down
28 changes: 19 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4312,6 +4312,12 @@ custom-event@~1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/custom-event/-/custom-event-1.0.1.tgz#5d02a46850adf1b4a317946a3928fccb5bfd0425"

[email protected]:
version "0.2.9"
resolved "https://registry.yarnpkg.com/customize-cra/-/customize-cra-0.2.9.tgz#9a6694c1d8671b548369e273945d6831816e5a78"
dependencies:
lodash.flow "^3.5.0"

cyclist@~0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640"
Expand Down Expand Up @@ -4965,14 +4971,14 @@ [email protected]:
version "6.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.0.0.tgz#24e37c041741c5f4b25324958ebbc34bca965935"

dotenv@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d"

dotenv@^5.0.1:
version "5.0.1"
resolved "http://registry.npmjs.org/dotenv/-/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef"

dotenv@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"

double-ended-queue@^2.1.0-0:
version "2.1.0-0"
resolved "https://registry.yarnpkg.com/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c"
Expand Down Expand Up @@ -9054,6 +9060,10 @@ lodash.flattendeep@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2"

lodash.flow@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/lodash.flow/-/lodash.flow-3.5.0.tgz#87bf40292b8cf83e4e8ce1a3ae4209e20071675a"

lodash.isarguments@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a"
Expand Down Expand Up @@ -12503,12 +12513,12 @@ [email protected]:
less-loader "^4.1.0"
npm "^6.4.1"

[email protected].2-next.0:
version "2.0.2-next.0"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.0.2-next.0.tgz#111711df73742a703f1f9dccc14f4cd263440a6d"
[email protected].1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.0.1.tgz#5c4902e68e78aa8851ef84a03579418b6f891e0b"
dependencies:
cross-spawn "^5.1.0"
dotenv "^4.0.0"
cross-spawn "^6.0.5"
dotenv "^6.2.0"
semver "^5.6.0"

react-copy-to-clipboard@^5.0.1:
Expand Down

0 comments on commit 9ec38d5

Please sign in to comment.