From 2490d5d13e02e0284150cc24eaf0b5f6b6e5c84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Thu, 16 Jan 2020 11:17:42 -0500 Subject: [PATCH 1/3] chore: pin yarn version in e2e vue tests --- scripts/integration-tests/e2e-vue-cli.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/integration-tests/e2e-vue-cli.sh b/scripts/integration-tests/e2e-vue-cli.sh index 018f7fb13287..262d75466cf6 100755 --- a/scripts/integration-tests/e2e-vue-cli.sh +++ b/scripts/integration-tests/e2e-vue-cli.sh @@ -22,9 +22,10 @@ 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 policies set-version 1.18.0 +yarn install +yarn lerna bootstrap # "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 From 99c53ea23743f18bc70266d31f3a16c77222220d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Thu, 16 Jan 2020 15:02:31 -0500 Subject: [PATCH 2/3] fix: replace yarn-upgrade by bump-babel-dependencies --- scripts/integration-tests/e2e-vue-cli.sh | 9 ++---- .../utils/bump-babel-dependencies.js | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 scripts/integration-tests/utils/bump-babel-dependencies.js diff --git a/scripts/integration-tests/e2e-vue-cli.sh b/scripts/integration-tests/e2e-vue-cli.sh index 262d75466cf6..b43ed96db988 100755 --- a/scripts/integration-tests/e2e-vue-cli.sh +++ b/scripts/integration-tests/e2e-vue-cli.sh @@ -22,13 +22,10 @@ cd tmp/vue-cli || exit #==============================================================================# startLocalRegistry "$PWD"/../../verdaccio-config.yml -# Workaround https://github.com/yarnpkg/yarn/issues/7797 -yarn policies set-version 1.18.0 yarn install -yarn lerna bootstrap -# "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 000000000000..03863f588847 --- /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)); +} From 1954d49e74af21285a0d3c0a986c77d9efdf8b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Thu, 16 Jan 2020 22:23:28 -0500 Subject: [PATCH 3/3] chore: update e2e-cra test --- scripts/integration-tests/e2e-create-react-app.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/integration-tests/e2e-create-react-app.sh b/scripts/integration-tests/e2e-create-react-app.sh index 1c956f240cee..8be49ae89902 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