Skip to content

Commit b6e0553

Browse files
authored
Merge pull request #11 from devloco/3.4.1
3.4.1
2 parents 5189102 + 707bf60 commit b6e0553

File tree

7 files changed

+93
-100
lines changed

7 files changed

+93
-100
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
3333
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
3434
const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
3535
// @remove-on-eject-begin
36-
const eslint = require('eslint');
3736
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
3837
// @remove-on-eject-end
3938
const postcssNormalize = require('postcss-normalize');
@@ -46,6 +45,8 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
4645
// makes for a smoother build process.
4746
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
4847

48+
const isExtendingEslintConfig = process.env.EXTEND_ESLINT === 'true';
49+
4950
const imageInlineSizeLimit = parseInt(
5051
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
5152
);
@@ -61,7 +62,7 @@ const sassModuleRegex = /\.module\.(scss|sass)$/;
6162

6263
// This is the production and development configuration.
6364
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
64-
module.exports = function(webpackEnv) {
65+
module.exports = function (webpackEnv) {
6566
const isEnvDevelopment = webpackEnv === 'development';
6667
const isEnvProduction = webpackEnv === 'production';
6768

@@ -189,12 +190,13 @@ module.exports = function(webpackEnv) {
189190
publicPath: paths.publicUrlOrPath,
190191
// Point sourcemap entries to original disk location (format as URL on Windows)
191192
devtoolModuleFilenameTemplate: isEnvProduction
192-
? info =>
193+
? (info) =>
193194
path
194195
.relative(paths.appSrc, info.absoluteResourcePath)
195196
.replace(/\\/g, '/')
196197
: isEnvDevelopment &&
197-
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
198+
((info) =>
199+
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
198200
// Prevents conflicts when multiple webpack runtimes (from different apps)
199201
// are used on the same page.
200202
jsonpFunction: `webpackJsonp${appPackageJson.name}`,
@@ -277,7 +279,7 @@ module.exports = function(webpackEnv) {
277279
// https://twitter.com/wSokra/status/969679223278505985
278280
// https://github.com/facebook/create-react-app/issues/5358
279281
runtimeChunk: {
280-
name: entrypoint => `runtime-${entrypoint.name}`,
282+
name: (entrypoint) => `runtime-${entrypoint.name}`,
281283
},
282284
},
283285
resolve: {
@@ -295,8 +297,8 @@ module.exports = function(webpackEnv) {
295297
// `web` extension prefixes have been added for better support
296298
// for React Native Web.
297299
extensions: paths.moduleFileExtensions
298-
.map(ext => `.${ext}`)
299-
.filter(ext => useTypeScript || !ext.includes('ts')),
300+
.map((ext) => `.${ext}`)
301+
.filter((ext) => useTypeScript || !ext.includes('ts')),
300302
alias: {
301303
// Support React Native Web
302304
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -346,28 +348,13 @@ module.exports = function(webpackEnv) {
346348
eslintPath: require.resolve('eslint'),
347349
resolvePluginsRelativeTo: __dirname,
348350
// @remove-on-eject-begin
349-
ignore: process.env.EXTEND_ESLINT === 'true',
350-
baseConfig: (() => {
351-
// We allow overriding the config only if the env variable is set
352-
if (process.env.EXTEND_ESLINT === 'true') {
353-
const eslintCli = new eslint.CLIEngine();
354-
let eslintConfig;
355-
try {
356-
eslintConfig = eslintCli.getConfigForFile(
357-
paths.appIndexJs
358-
);
359-
} catch (e) {
360-
console.error(e);
361-
process.exit(1);
362-
}
363-
return eslintConfig;
364-
} else {
365-
return {
351+
ignore: isExtendingEslintConfig,
352+
baseConfig: isExtendingEslintConfig
353+
? undefined
354+
: {
366355
extends: [require.resolve('eslint-config-react-app')],
367-
};
368-
}
369-
})(),
370-
useEslintrc: false,
356+
},
357+
useEslintrc: isExtendingEslintConfig,
371358
// @remove-on-eject-end
372359
},
373360
loader: require.resolve('eslint-loader'),
@@ -653,7 +640,7 @@ module.exports = function(webpackEnv) {
653640
return manifest;
654641
}, seed);
655642
const entrypointFiles = entrypoints.main.filter(
656-
fileName => !fileName.endsWith('.map')
643+
(fileName) => !fileName.endsWith('.map')
657644
);
658645

659646
return {

packages/react-scripts/config/webpack.config.wptheme.js

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
3333
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
3434
const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
3535
// @remove-on-eject-begin
36-
const eslint = require('eslint');
3736
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
3837
// @remove-on-eject-end
3938
const postcssNormalize = require('postcss-normalize');
@@ -58,6 +57,8 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
5857
// makes for a smoother build process.
5958
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
6059

60+
const isExtendingEslintConfig = process.env.EXTEND_ESLINT === 'true';
61+
6162
const imageInlineSizeLimit = parseInt(
6263
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
6364
);
@@ -354,28 +355,13 @@ module.exports = function (webpackEnv) {
354355
eslintPath: require.resolve('eslint'),
355356
resolvePluginsRelativeTo: __dirname,
356357
// @remove-on-eject-begin
357-
ignore: process.env.EXTEND_ESLINT === 'true',
358-
baseConfig: (() => {
359-
// We allow overriding the config only if the env variable is set
360-
if (process.env.EXTEND_ESLINT === 'true') {
361-
const eslintCli = new eslint.CLIEngine();
362-
let eslintConfig;
363-
try {
364-
eslintConfig = eslintCli.getConfigForFile(
365-
paths.appIndexJs
366-
);
367-
} catch (e) {
368-
console.error(e);
369-
process.exit(1);
370-
}
371-
return eslintConfig;
372-
} else {
373-
return {
358+
ignore: isExtendingEslintConfig,
359+
baseConfig: isExtendingEslintConfig
360+
? undefined
361+
: {
374362
extends: [require.resolve('eslint-config-react-app')],
375-
};
376-
}
377-
})(),
378-
useEslintrc: false,
363+
},
364+
useEslintrc: isExtendingEslintConfig,
379365
// @remove-on-eject-end
380366
},
381367
loader: require.resolve('eslint-loader'),

packages/react-scripts/cra-original-package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-scripts",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"description": "Configuration and scripts for Create React App.",
55
"repository": {
66
"type": "git",
@@ -28,27 +28,27 @@
2828
},
2929
"types": "./lib/react-app.d.ts",
3030
"dependencies": {
31-
"@babel/core": "7.8.4",
31+
"@babel/core": "7.9.0",
3232
"@svgr/webpack": "4.3.3",
3333
"@typescript-eslint/eslint-plugin": "^2.10.0",
3434
"@typescript-eslint/parser": "^2.10.0",
35-
"babel-eslint": "10.0.3",
35+
"babel-eslint": "10.1.0",
3636
"babel-jest": "^24.9.0",
37-
"babel-loader": "8.0.6",
37+
"babel-loader": "8.1.0",
3838
"babel-plugin-named-asset-import": "^0.3.6",
39-
"babel-preset-react-app": "^9.1.1",
39+
"babel-preset-react-app": "^9.1.2",
4040
"camelcase": "^5.3.1",
4141
"case-sensitive-paths-webpack-plugin": "2.3.0",
4242
"css-loader": "3.4.2",
4343
"dotenv": "8.2.0",
4444
"dotenv-expand": "5.1.0",
4545
"eslint": "^6.6.0",
46-
"eslint-config-react-app": "^5.2.0",
46+
"eslint-config-react-app": "^5.2.1",
4747
"eslint-loader": "3.0.3",
4848
"eslint-plugin-flowtype": "4.6.0",
49-
"eslint-plugin-import": "2.20.0",
49+
"eslint-plugin-import": "2.20.1",
5050
"eslint-plugin-jsx-a11y": "6.2.3",
51-
"eslint-plugin-react": "7.18.0",
51+
"eslint-plugin-react": "7.19.0",
5252
"eslint-plugin-react-hooks": "^1.6.1",
5353
"file-loader": "4.3.0",
5454
"fs-extra": "^8.1.0",
@@ -60,24 +60,24 @@
6060
"jest-watch-typeahead": "0.4.2",
6161
"mini-css-extract-plugin": "0.9.0",
6262
"optimize-css-assets-webpack-plugin": "5.0.3",
63-
"pnp-webpack-plugin": "1.6.0",
63+
"pnp-webpack-plugin": "1.6.4",
6464
"postcss-flexbugs-fixes": "4.1.0",
6565
"postcss-loader": "3.0.0",
6666
"postcss-normalize": "8.0.1",
6767
"postcss-preset-env": "6.7.0",
6868
"postcss-safe-parser": "4.0.1",
6969
"react-app-polyfill": "^1.0.6",
70-
"react-dev-utils": "^10.2.0",
70+
"react-dev-utils": "^10.2.1",
7171
"resolve": "1.15.0",
7272
"resolve-url-loader": "3.1.1",
7373
"sass-loader": "8.0.2",
7474
"semver": "6.3.0",
7575
"style-loader": "0.23.1",
76-
"terser-webpack-plugin": "2.3.4",
77-
"ts-pnp": "1.1.5",
76+
"terser-webpack-plugin": "2.3.5",
77+
"ts-pnp": "1.1.6",
7878
"url-loader": "2.3.0",
79-
"webpack": "4.41.5",
80-
"webpack-dev-server": "3.10.2",
79+
"webpack": "4.42.0",
80+
"webpack-dev-server": "3.10.3",
8181
"webpack-manifest-plugin": "2.2.0",
8282
"workbox-webpack-plugin": "4.3.1"
8383
},

packages/react-scripts/package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devloco/react-scripts-wptheme",
3-
"version": "3.4.0-wp.10",
3+
"version": "3.4.1-wp.1",
44
"description": "Configuration and scripts for Create React WP Theme.",
55
"repository": {
66
"type": "git",
@@ -42,27 +42,27 @@
4242
},
4343
"types": "./lib/react-app.d.ts",
4444
"dependencies": {
45-
"@babel/core": "7.8.4",
45+
"@babel/core": "7.9.0",
4646
"@svgr/webpack": "4.3.3",
4747
"@typescript-eslint/eslint-plugin": "^2.10.0",
4848
"@typescript-eslint/parser": "^2.10.0",
49-
"babel-eslint": "10.0.3",
49+
"babel-eslint": "10.1.0",
5050
"babel-jest": "^24.9.0",
51-
"babel-loader": "8.0.6",
51+
"babel-loader": "8.1.0",
5252
"babel-plugin-named-asset-import": "^0.3.6",
53-
"babel-preset-react-app": "^9.1.1",
53+
"babel-preset-react-app": "^9.1.2",
5454
"camelcase": "^5.3.1",
5555
"case-sensitive-paths-webpack-plugin": "2.3.0",
5656
"css-loader": "3.4.2",
5757
"dotenv": "8.2.0",
5858
"dotenv-expand": "5.1.0",
5959
"eslint": "^6.6.0",
60-
"eslint-config-react-app": "^5.2.0",
60+
"eslint-config-react-app": "^5.2.1",
6161
"eslint-loader": "3.0.3",
6262
"eslint-plugin-flowtype": "4.6.0",
63-
"eslint-plugin-import": "2.20.0",
63+
"eslint-plugin-import": "2.20.1",
6464
"eslint-plugin-jsx-a11y": "6.2.3",
65-
"eslint-plugin-react": "7.18.0",
65+
"eslint-plugin-react": "7.19.0",
6666
"eslint-plugin-react-hooks": "^1.6.1",
6767
"file-loader": "4.3.0",
6868
"fs-extra": "^8.1.0",
@@ -74,27 +74,27 @@
7474
"jest-watch-typeahead": "0.4.2",
7575
"mini-css-extract-plugin": "0.9.0",
7676
"optimize-css-assets-webpack-plugin": "5.0.3",
77-
"pnp-webpack-plugin": "1.6.0",
77+
"pnp-webpack-plugin": "1.6.4",
7878
"postcss-flexbugs-fixes": "4.1.0",
7979
"postcss-loader": "3.0.0",
8080
"postcss-normalize": "8.0.1",
8181
"postcss-preset-env": "6.7.0",
8282
"postcss-safe-parser": "4.0.1",
8383
"react-app-polyfill": "^1.0.6",
84-
"react-dev-utils": "^10.2.0",
84+
"react-dev-utils": "^10.2.1",
8585
"resolve": "1.15.0",
8686
"resolve-url-loader": "3.1.1",
8787
"sass-loader": "8.0.2",
8888
"semver": "6.3.0",
8989
"style-loader": "0.23.1",
90-
"terser-webpack-plugin": "2.3.4",
91-
"ts-pnp": "1.1.5",
90+
"terser-webpack-plugin": "2.3.5",
91+
"ts-pnp": "1.1.6",
9292
"url-loader": "2.3.0",
93-
"webpack": "4.41.5",
94-
"webpack-dev-server": "3.10.2",
93+
"webpack": "4.42.0",
94+
"webpack-dev-server": "3.10.3",
9595
"webpack-manifest-plugin": "2.2.0",
9696
"workbox-webpack-plugin": "4.3.1",
97-
"@devloco/create-react-wptheme-utils": "^3.4.0-wp.12"
97+
"@devloco/create-react-wptheme-utils": "^3.4.1-wp.1"
9898
},
9999
"devDependencies": {
100100
"react": "^16.12.0",

packages/react-scripts/scripts/init.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Makes the script crash on unhandled rejections instead of silently
1111
// ignoring them. In the future, promise rejections that are not handled will
1212
// terminate the Node.js process with a non-zero exit code.
13-
process.on('unhandledRejection', err => {
13+
process.on('unhandledRejection', (err) => {
1414
throw err;
1515
});
1616

@@ -84,7 +84,7 @@ function tryGitCommit(appPath) {
8484
}
8585
}
8686

87-
module.exports = function(
87+
module.exports = function (
8888
appPath,
8989
appName,
9090
verbose,
@@ -163,12 +163,14 @@ module.exports = function(
163163

164164
// Keys from templatePackage that will be added to appPackage,
165165
// replacing any existing entries.
166-
const templatePackageToReplace = Object.keys(templatePackage).filter(key => {
167-
return (
168-
!templatePackageBlacklist.includes(key) &&
169-
!templatePackageToMerge.includes(key)
170-
);
171-
});
166+
const templatePackageToReplace = Object.keys(templatePackage).filter(
167+
(key) => {
168+
return (
169+
!templatePackageBlacklist.includes(key) &&
170+
!templatePackageToMerge.includes(key)
171+
);
172+
}
173+
);
172174

173175
// Copy over some of the devDependencies
174176
appPackage.dependencies = appPackage.dependencies || {};
@@ -206,7 +208,7 @@ module.exports = function(
206208
appPackage.browserslist = defaultBrowsers;
207209

208210
// Add templatePackage keys/values to appPackage, replacing existing entries
209-
templatePackageToReplace.forEach(key => {
211+
templatePackageToReplace.forEach((key) => {
210212
appPackage[key] = templatePackage[key];
211213
});
212214

@@ -297,7 +299,7 @@ module.exports = function(
297299
} else {
298300
command = 'npm';
299301
remove = 'uninstall';
300-
args = ['install', '--save', verbose && '--verbose'].filter(e => e);
302+
args = ['install', '--save', verbose && '--verbose'].filter((e) => e);
301303
}
302304

303305
// Install additional template dependencies, if present
@@ -306,7 +308,7 @@ module.exports = function(
306308
templatePackage.dependencies || templateJson.dependencies;
307309
if (templateDependencies) {
308310
args = args.concat(
309-
Object.keys(templateDependencies).map(key => {
311+
Object.keys(templateDependencies).map((key) => {
310312
return `${key}@${templateDependencies[key]}`;
311313
})
312314
);
@@ -330,7 +332,7 @@ module.exports = function(
330332
}
331333
}
332334

333-
if (args.find(arg => arg.includes('typescript'))) {
335+
if (args.find((arg) => arg.includes('typescript'))) {
334336
console.log();
335337
verifyTypeScriptSetup();
336338
}

0 commit comments

Comments
 (0)