diff --git a/scripts/integration-tests/e2e-create-react-app.sh b/scripts/integration-tests/e2e-create-react-app.sh index 1c956f240c..8be49ae899 100755 --- a/scripts/integration-tests/e2e-create-react-app.sh +++ b/scripts/integration-tests/e2e-create-react-app.sh @@ -23,9 +23,9 @@ cd tmp/create-react-app || exit startLocalRegistry "$PWD"/../../verdaccio-config.yml yarn install -# "yarn upgrade --scope @babel --latest" doesn't seem to work. -# a means "all", while \n is the enter needed to confirm the selection. -printf "a\n" | yarn upgrade-interactive --scope @babel --latest +node "$PWD"/../../utils/bump-babel-dependencies.js +yarn lerna exec -- node "$PWD"/../../utils/bump-babel-dependencies.js +yarn install # Test CI=true yarn test diff --git a/scripts/integration-tests/e2e-vue-cli.sh b/scripts/integration-tests/e2e-vue-cli.sh index 018f7fb132..b43ed96db9 100755 --- a/scripts/integration-tests/e2e-vue-cli.sh +++ b/scripts/integration-tests/e2e-vue-cli.sh @@ -23,11 +23,9 @@ cd tmp/vue-cli || exit startLocalRegistry "$PWD"/../../verdaccio-config.yml yarn install -# Workaround https://github.com/yarnpkg/yarn/issues/7797 -yarn add --dev -W @babel/core -# "yarn upgrade --scope @babel --latest" doesn't seem to work. -# a means "all", while \n is the enter needed to confirm the selection. -printf "a\n" | yarn upgrade-interactive --scope @babel --latest +node "$PWD"/../../utils/bump-babel-dependencies.js +yarn lerna exec -- node "$PWD"/../../utils/bump-babel-dependencies.js +yarn install # Test CI=true yarn test -p babel,babel-preset-app diff --git a/scripts/integration-tests/utils/bump-babel-dependencies.js b/scripts/integration-tests/utils/bump-babel-dependencies.js new file mode 100644 index 0000000000..03863f5888 --- /dev/null +++ b/scripts/integration-tests/utils/bump-babel-dependencies.js @@ -0,0 +1,29 @@ +const fs = require("fs"); +const path = require("path"); +const cwd = process.cwd(); +const packageJSONPath = path.resolve(cwd, "./package.json"); +const content = JSON.parse(fs.readFileSync(packageJSONPath)); + +let bumped = false; +function bumpBabelDependency(dependencies) { + for (const dep of Object.keys(dependencies)) { + if (dep.startsWith("@babel/")) { + dependencies[dep] = "latest"; + bumped = true; + } + } +} + +if ("peerDependencies" in content) { + bumpBabelDependency(content.peerDependencies); +} +if ("devDependencies" in content) { + bumpBabelDependency(content.devDependencies); +} +if ("dependencies" in content) { + bumpBabelDependency(content.dependencies); +} + +if (bumped) { + fs.writeFileSync(packageJSONPath, JSON.stringify(content, undefined, 2)); +}