Skip to content

Run yarn during ejecting to avoid hoisting issues and fix CI #3806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/babel-preset-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@babel/core": "7.0.0-beta.37",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.37",
"@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.37",
"@babel/plugin-syntax-dynamic-import": "7.0.0-beta.37",
"@babel/plugin-transform-classes": "7.0.0-beta.37",
"@babel/plugin-transform-destructuring": "7.0.0-beta.37",
"@babel/plugin-transform-react-constant-elements": "7.0.0-beta.37",
Expand Down
2 changes: 1 addition & 1 deletion packages/confusing-browser-globals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"index.js"
],
"devDependencies": {
"jest": "22.0.6"
"jest": "22.1.1"
}
}
2 changes: 1 addition & 1 deletion packages/react-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"text-table": "0.2.0"
},
"devDependencies": {
"jest": "22.0.6"
"jest": "22.1.1"
},
"scripts": {
"test": "jest"
Expand Down
10 changes: 5 additions & 5 deletions packages/react-error-overlay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
"lib/index.js"
],
"devDependencies": {
"@babel/code-frame": "7.0.0-beta.36",
"@babel/core": "7.0.0-beta.36",
"@babel/runtime": "7.0.0-beta.36",
"@babel/code-frame": "7.0.0-beta.37",
"@babel/core": "7.0.0-beta.37",
"@babel/runtime": "7.0.0-beta.37",
"anser": "1.4.4",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^8.0.2",
"babel-jest": "^22.0.6",
"babel-jest": "^22.1.0",
"babel-loader": "^8.0.0-beta.0",
"babel-preset-react-app": "^3.1.1",
"chalk": "^2.1.0",
Expand All @@ -50,7 +50,7 @@
"eslint-plugin-react": "7.5.1",
"flow-bin": "^0.63.1",
"html-entities": "1.2.1",
"jest": "22.0.6",
"jest": "22.1.1",
"jest-fetch-mock": "1.2.1",
"object-assign": "4.1.1",
"promise": "8.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"autoprefixer": "7.2.5",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "8.2.1",
"babel-jest": "22.0.6",
"babel-jest": "22.1.0",
"babel-loader": "8.0.0-beta.0",
"babel-preset-react-app": "^3.1.1",
"case-sensitive-paths-webpack-plugin": "2.1.1",
Expand All @@ -45,7 +45,7 @@
"file-loader": "1.1.6",
"fs-extra": "5.0.0",
"html-webpack-plugin": "2.30.1",
"jest": "22.0.6",
"jest": "22.1.1",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.10",
Expand Down
44 changes: 29 additions & 15 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,35 @@ inquirer
}

if (fs.existsSync(paths.yarnLockFile)) {
// TODO: this is disabled for three reasons.
//
// 1. It produces garbage warnings on Windows on some systems:
// https://github.com/facebookincubator/create-react-app/issues/2030
//
// 2. For the above reason, it breaks Windows CI:
// https://github.com/facebookincubator/create-react-app/issues/2624
//
// 3. It is wrong anyway: re-running yarn will respect the lockfile
// rather than package.json we just updated. Instead we should have
// updated the lockfile. So we might as well not do it while it's broken.
// https://github.com/facebookincubator/create-react-app/issues/2627
//
// console.log(cyan('Running yarn...'));
// spawnSync('yarnpkg', [], { stdio: 'inherit' });
const windowsCmdFilePath = path.join(
appPath,
'node_modules',
'.bin',
'react-scripts.cmd'
);
let windowsCmdFileContent;
if (process.platform === 'win32') {
// https://github.com/facebookincubator/create-react-app/pull/3806#issuecomment-357781035
// Yarn is diligent about cleaning up after itself, but this causes the react-scripts.cmd file
// to be deleted while it is running. This trips Windows up after the eject completes.
// We'll read the batch file and later "write it back" to match npm behavior.
try {
windowsCmdFileContent = fs.readFileSync(windowsCmdFilePath);
} catch (err) {
// If this fails we're not worse off than if we didn't try to fix it.
}
}

console.log(cyan('Running yarn...'));
spawnSync('yarnpkg', ['--cwd', process.cwd()], { stdio: 'inherit' });

if (windowsCmdFileContent && !fs.existsSync(windowsCmdFilePath)) {
try {
fs.writeFileSync(windowsCmdFilePath, windowsCmdFileContent);
} catch (err) {
// If this fails we're not worse off than if we didn't try to fix it.
}
}
} else {
console.log(cyan('Running npm install...'));
spawnSync('npm', ['install', '--loglevel', 'error'], {
Expand Down