Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f63f817

Browse files
authored
Merge branch 'master' into v3.3.0-fix-package-name
2 parents 28d7a3b + a4d9ee5 commit f63f817

File tree

6 files changed

+56
-5
lines changed

6 files changed

+56
-5
lines changed

‎packages/react-scripts/README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# :warning: WARNING!
2+
3+
This is a custom scripts-version of React-Scripts that provides Monorepo support.
4+
5+
See [React Workspaces Playground](https://github.com/react-workspaces/react-workspaces-playground) for a working demo.
6+
7+
[![React Workspaces Playground Screenshots](https://i.imgur.com/7snWXD0.png)](https://github.com/react-workspaces/react-workspaces-playground)
8+
9+
For more information on why this ways created, please read this for more info: https://github.com/F1LT3R/cra-workspaces-support-1333
10+
111
# react-scripts
212

313
This package includes scripts and configuration used by [Create React App](https://github.com/facebook/create-react-app).<br>

‎packages/react-scripts/config/paths.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
const path = require('path');
1212
const fs = require('fs');
1313
const url = require('url');
14+
const findUp = require('find-up');
1415

1516
// Make sure any symlinks in the project folder are resolved:
1617
// https://github.com/facebook/create-react-app/issues/637
@@ -122,7 +123,9 @@ module.exports = {
122123
};
123124

124125
const ownPackageJson = require('../package.json');
125-
const reactScriptsPath = resolveApp(`node_modules/${ownPackageJson.name}`);
126+
const reactScriptsPath = findUp.sync(`node_modules/${ownPackageJson.name}`, {
127+
cwd: resolveApp('.'),
128+
});
126129
const reactScriptsLinked =
127130
fs.existsSync(reactScriptsPath) &&
128131
fs.lstatSync(reactScriptsPath).isSymbolicLink();

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,27 @@ module.exports = function(webpackEnv) {
9393
// passed into alias object. Uses a flag if passed into the build command
9494
const isEnvProductionProfile =
9595
isEnvProduction && process.argv.includes('--profile');
96+
97+
const workspacesMainFields = [
98+
workspacesConfig.packageEntry,
99+
'browser',
100+
'module',
101+
'main',
102+
];
103+
104+
const mainFields =
105+
isEnvDevelopment && workspacesConfig.development
106+
? workspacesMainFields
107+
: isEnvProduction && workspacesConfig.production
108+
? workspacesMainFields
109+
: undefined;
110+
111+
const includePaths =
112+
isEnvDevelopment && workspacesConfig.development
113+
? [paths.appSrc, ...workspacesConfig.paths]
114+
: isEnvProduction && workspacesConfig.production
115+
? [paths.appSrc, ...workspacesConfig.paths]
116+
: paths.appSrc;
96117

97118
// Webpack uses `publicPath` to determine where the app is being served from.
98119
// It requires a trailing slash, or the file assets will get an incorrect path.
@@ -723,6 +744,10 @@ module.exports = function(webpackEnv) {
723744
typescript: resolve.sync('typescript', {
724745
basedir: paths.appNodeModules,
725746
}),
747+
compilerOptions: {
748+
skipLibCheck: true,
749+
suppressOutputPathCheck: true,
750+
},
726751
async: isEnvDevelopment,
727752
useTypescriptIncrementalApi: true,
728753
checkSyntacticErrors: true,

‎packages/react-scripts/config/yarn-workspaces.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ const findUp = require('find-up');
66
const glob = require('glob');
77

88
const loadPackageJson = packagePath => {
9-
const packageObj = fse.readJsonSync(packagePath);
10-
return packageObj;
9+
try {
10+
const packageObj = fse.readJsonSync(packagePath);
11+
return packageObj;
12+
} catch (err) {
13+
throw err;
14+
}
1115
};
1216

1317
const getWorkspacesRootConfig = dir => {

‎packages/react-scripts/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"description": "Configuration and scripts for Create React App.",
55
"repository": {
66
"type": "git",
7-
"url": "https://github.com/facebook/create-react-app.git",
7+
"url": "https://github.com/react-workspaces/create-react-app.git",
88
"directory": "packages/react-scripts"
99
},
1010
"license": "MIT",
1111
"engines": {
1212
"node": ">=8.10"
1313
},
1414
"bugs": {
15-
"url": "https://github.com/facebook/create-react-app/issues"
15+
"url": "https://github.com/react-workspaces/create-react-app/issues"
1616
},
1717
"files": [
1818
"bin",

‎packages/react-scripts/scripts/start.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ checkBrowsers(paths.appPath, isInteractive)
154154
process.exit();
155155
});
156156
});
157+
158+
// We need this to close the WebPack Server
159+
// Thanks @1player! https://github.com/facebook/create-react-app/issues/1753#issuecomment-329972786
160+
process.stdin.on("end", function() {
161+
devServer.close();
162+
process.exit();
163+
});
164+
165+
process.stdin.resume();
157166
})
158167
.catch(err => {
159168
if (err && err.message) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /