diff --git a/README.md b/README.md index 4343c5ef13d..b01f4fe5e48 100644 --- a/README.md +++ b/README.md @@ -217,4 +217,4 @@ We are grateful to the authors of existing related projects for their ideas and ## License -Create React App is open source software [licensed as MIT](https://github.com/facebook/create-react-app/blob/master/LICENSE). The Create React App logo is licensed under a [Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by/4.0/). +Create React App is open source software [licensed as MIT](https://github.com/facebook/create-react-app/blob/master/LICENSE). The Create React App logo is licensed under a [Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by/4.0/). diff --git a/packages/react-scripts/bin/react-scripts.js b/packages/react-scripts/bin/react-scripts.js old mode 100755 new mode 100644 diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index eddca1b0707..3cbf28cb9aa 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -30,6 +30,8 @@ const ESLintPlugin = require('eslint-webpack-plugin'); const paths = require('./paths'); const modules = require('./modules'); const getClientEnvironment = require('./env'); +const spawn = require('cross-spawn'); +const root = require('find-yarn-workspace-root')(); const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin'); const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin'); const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); @@ -71,6 +73,21 @@ const cssModuleRegex = /\.module\.css$/; const sassRegex = /\.(scss|sass)$/; const sassModuleRegex = /\.module\.(scss|sass)$/; +let includedSources; +if (root) { + const vrs = spawn.sync('yarn', ['-v']); + const pgks = spawn.sync('yarn', ['workspaces', 'info', '--json']); + const output = JSON.parse(pgks.output[1].toString()); + const version = vrs.output[1].toString(); + const packages = version < '1.22.0' ? JSON.parse(output.data) : output; + + includedSources = Object.values(packages).map(val => + path.join(root, val.location) + ); +} else { + includedSources = paths.appSrc; +} + const hasJsxRuntime = (() => { if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') { return false; @@ -351,10 +368,7 @@ module.exports = function (webpackEnv) { // To fix this, we prevent you from importing files out of src/ -- if you'd like to, // please link the files into your node_modules/ and let module-resolution kick in. // Make sure your source files are compiled, as they will not be processed in any way. - new ModuleScopePlugin(paths.appSrc, [ - paths.appPackageJson, - reactRefreshOverlayEntry, - ]), + new ModuleScopePlugin(paths.appSrc, [reactRefreshOverlayEntry]), ], }, resolveLoader: { @@ -400,7 +414,7 @@ module.exports = function (webpackEnv) { // The preset includes JSX, Flow, TypeScript, and some ESnext features. { test: /\.(js|mjs|jsx|ts|tsx)$/, - include: paths.appSrc, + include: includedSources, loader: require.resolve('babel-loader'), options: { customize: require.resolve( diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index e37da8f4efa..86211f94bcf 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,10 +1,10 @@ { - "name": "react-scripts", - "version": "4.0.1", - "description": "Configuration and scripts for Create React App.", + "name": "@nosplatform/react-scripts", + "version": "4.0.1-nosplatform.1", + "description": "nOS Configuration and scripts for Create React App.", "repository": { "type": "git", - "url": "https://github.com/facebook/create-react-app.git", + "url": "https://github.com/nos/create-react-app.git", "directory": "packages/react-scripts" }, "license": "MIT", @@ -12,7 +12,7 @@ "node": "^10.12.0 || >=12.0.0" }, "bugs": { - "url": "https://github.com/facebook/create-react-app/issues" + "url": "https://github.com/nos/create-react-app/issues" }, "files": [ "bin", @@ -55,6 +55,7 @@ "eslint-plugin-testing-library": "^3.9.2", "eslint-webpack-plugin": "^2.1.0", "file-loader": "6.1.1", + "find-yarn-workspace-root": "2.0.0", "fs-extra": "^9.0.1", "html-webpack-plugin": "4.5.0", "identity-obj-proxy": "3.0.0", @@ -113,5 +114,8 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js index 04e6e4e0020..1d1faf95ff3 100644 --- a/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js +++ b/packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js @@ -221,7 +221,9 @@ function verifyTypeScriptSetup() { } else { // This is bug fix code of https://github.com/facebook/create-react-app/issues/9868 // Bellow code release variable from non-extensible and freeze status. - appTsConfig.compilerOptions = JSON.parse(JSON.stringify(appTsConfig.compilerOptions)); + appTsConfig.compilerOptions = JSON.parse( + JSON.stringify(appTsConfig.compilerOptions) + ); // Original appTsConfig.compilerOptions status // Object.isExtensible(appTsConfig.compilerOptions) output: false