Skip to content

Commit 667c5f2

Browse files
authored
Try to fix CI (facebook#3806)
* Try to fix CI * Bump Jest elsewhere * Bump Babel elsewhere * Fix CI on Windows by writing .cmd file back
1 parent 0131955 commit 667c5f2

File tree

2 files changed

+31
-17
lines changed

2 files changed

+31
-17
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"autoprefixer": "7.2.5",
2727
"babel-core": "7.0.0-bridge.0",
2828
"babel-eslint": "8.2.1",
29-
"babel-jest": "22.0.6",
29+
"babel-jest": "22.1.0",
3030
"babel-loader": "8.0.0-beta.0",
3131
"babel-preset-react-app": "^3.1.1",
3232
"case-sensitive-paths-webpack-plugin": "2.1.1",
@@ -45,7 +45,7 @@
4545
"file-loader": "1.1.6",
4646
"fs-extra": "5.0.0",
4747
"html-webpack-plugin": "2.30.1",
48-
"jest": "22.0.6",
48+
"jest": "22.1.1",
4949
"object-assign": "4.1.1",
5050
"postcss-flexbugs-fixes": "3.2.0",
5151
"postcss-loader": "2.0.10",

scripts/eject.js

+29-15
Original file line numberDiff line numberDiff line change
@@ -237,21 +237,35 @@ inquirer
237237
}
238238

239239
if (fs.existsSync(paths.yarnLockFile)) {
240-
// TODO: this is disabled for three reasons.
241-
//
242-
// 1. It produces garbage warnings on Windows on some systems:
243-
// https://github.com/facebookincubator/create-react-app/issues/2030
244-
//
245-
// 2. For the above reason, it breaks Windows CI:
246-
// https://github.com/facebookincubator/create-react-app/issues/2624
247-
//
248-
// 3. It is wrong anyway: re-running yarn will respect the lockfile
249-
// rather than package.json we just updated. Instead we should have
250-
// updated the lockfile. So we might as well not do it while it's broken.
251-
// https://github.com/facebookincubator/create-react-app/issues/2627
252-
//
253-
// console.log(cyan('Running yarn...'));
254-
// spawnSync('yarnpkg', [], { stdio: 'inherit' });
240+
const windowsCmdFilePath = path.join(
241+
appPath,
242+
'node_modules',
243+
'.bin',
244+
'react-scripts.cmd'
245+
);
246+
let windowsCmdFileContent;
247+
if (process.platform === 'win32') {
248+
// https://github.com/facebookincubator/create-react-app/pull/3806#issuecomment-357781035
249+
// Yarn is diligent about cleaning up after itself, but this causes the react-scripts.cmd file
250+
// to be deleted while it is running. This trips Windows up after the eject completes.
251+
// We'll read the batch file and later "write it back" to match npm behavior.
252+
try {
253+
windowsCmdFileContent = fs.readFileSync(windowsCmdFilePath);
254+
} catch (err) {
255+
// If this fails we're not worse off than if we didn't try to fix it.
256+
}
257+
}
258+
259+
console.log(cyan('Running yarn...'));
260+
spawnSync('yarnpkg', ['--cwd', process.cwd()], { stdio: 'inherit' });
261+
262+
if (windowsCmdFileContent && !fs.existsSync(windowsCmdFilePath)) {
263+
try {
264+
fs.writeFileSync(windowsCmdFilePath, windowsCmdFileContent);
265+
} catch (err) {
266+
// If this fails we're not worse off than if we didn't try to fix it.
267+
}
268+
}
255269
} else {
256270
console.log(cyan('Running npm install...'));
257271
spawnSync('npm', ['install', '--loglevel', 'error'], {

0 commit comments

Comments
 (0)