Skip to content

Commit 72c3d4e

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 19e0bb1 commit 72c3d4e

File tree

6 files changed

+39
-25
lines changed

6 files changed

+39
-25
lines changed

packages/babel-preset-react-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dependencies": {
1515
"@babel/core": "7.0.0-beta.37",
1616
"@babel/plugin-proposal-class-properties": "7.0.0-beta.37",
17-
"@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.37",
17+
"@babel/plugin-syntax-dynamic-import": "7.0.0-beta.37",
1818
"@babel/plugin-transform-classes": "7.0.0-beta.37",
1919
"@babel/plugin-transform-destructuring": "7.0.0-beta.37",
2020
"@babel/plugin-transform-react-constant-elements": "7.0.0-beta.37",

packages/confusing-browser-globals/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"index.js"
1717
],
1818
"devDependencies": {
19-
"jest": "22.0.6"
19+
"jest": "22.1.1"
2020
}
2121
}

packages/react-dev-utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"text-table": "0.2.0"
6060
},
6161
"devDependencies": {
62-
"jest": "22.0.6"
62+
"jest": "22.1.1"
6363
},
6464
"scripts": {
6565
"test": "jest"

packages/react-error-overlay/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
"lib/index.js"
3131
],
3232
"devDependencies": {
33-
"@babel/code-frame": "7.0.0-beta.36",
34-
"@babel/core": "7.0.0-beta.36",
35-
"@babel/runtime": "7.0.0-beta.36",
33+
"@babel/code-frame": "7.0.0-beta.37",
34+
"@babel/core": "7.0.0-beta.37",
35+
"@babel/runtime": "7.0.0-beta.37",
3636
"anser": "1.4.4",
3737
"babel-core": "^7.0.0-bridge.0",
3838
"babel-eslint": "^8.0.2",
39-
"babel-jest": "^22.0.6",
39+
"babel-jest": "^22.1.0",
4040
"babel-loader": "^8.0.0-beta.0",
4141
"babel-preset-react-app": "^3.1.1",
4242
"chalk": "^2.1.0",
@@ -50,7 +50,7 @@
5050
"eslint-plugin-react": "7.5.1",
5151
"flow-bin": "^0.63.1",
5252
"html-entities": "1.2.1",
53-
"jest": "22.0.6",
53+
"jest": "22.1.1",
5454
"jest-fetch-mock": "1.2.1",
5555
"object-assign": "4.1.1",
5656
"promise": "8.0.1",

packages/react-scripts/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",

packages/react-scripts/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)