Use Yarn 2 (#11962)

* chore: use yarn 2

* chore: remove redundant yarn locks

* chore: remove publishEslintPkg

* chore: remove redundant make bootstrap

* Update .yarnrc.yml

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* chore: use workspace protocol for eslint packages in the root

Co-Authored-By: merceyz <merceyz@users.noreply.github.com>

* chore: pin caniuse-lite versions

Testcases in packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie
depends on specific caniuse-lite versions. We pinned the version here
so we don't have to deal with fixture different in e2e-tests
where all deps will be updated and tested.

* chore: resolve yarn install warnings

* chore: update yarn cache path on circle/travis

* chore: add yarn deduplicate plugin

* chore: deduplicate lock files

* chore: move devDependencies to leaf packages

* chore: remove @yarnpkg/plugin-constraints

* chore: remove unused dedupe options

* test: fix unwanted self reference

* chore: remove output-file-sync dependency

* chore: update browserify to 16.5.2

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
This commit is contained in:
Huáng Jùnliàng
2020-08-25 14:37:30 -04:00
committed by GitHub
parent 304eea4133
commit 3fad7eab9b
193 changed files with 17817 additions and 24927 deletions

View File

@@ -22,27 +22,29 @@ cd ../..
startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml
# Install dependencies in individual packages so that we can link them at the top level.
# todo: remove `-- -- --ignore-engines` in Babel 8
for package in eslint/*/; do yarn --ignore-engines --cwd $package; done
node "$PWD"/scripts/integration-tests/utils/bump-babel-dependencies.js
(
yarn why @babel/core | grep -o "@babel/core@npm:.* (via npm:.*)";
yarn why @babel/helpers | grep -o "@babel/helpers@npm:.* (via npm:.*)";
yarn why @babel/traverse | grep -o "@babel/traverse@npm:.* (via npm:.*)"
) | uniq | node -e "
var pkg = require('./package.json');
var packages = fs.readFileSync(0, 'utf8').trim().split('\n');
yarn upgrade --scope @babel
pkg.devDependencies['@babel/core'] = '7.0.0';
node -e "\
var pkg = require('./package.json');\
pkg.devDependencies['@babel/core'] = '7.0.0';\
Object.assign(pkg.resolutions, {\
'@babel/core': '7.0.0',\
'@babel/helpers': '7.0.0',\
'@babel/traverse': '7.0.0'\
});\
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));\
packages.forEach(desc => {
const { name, specifier } = desc
.match(/(?<name>@babel\/[a-z]+).*\(via (?<specifier>npm:[^)]+)\)/)
.groups;
pkg.resolutions[name + '@' + specifier] = '7.0.0';
});
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
"
# Update deps, build and test
rm yarn.lock
make bootstrap
# Test
make test-ci
make -j test-ci
cleanup

View File

@@ -21,14 +21,12 @@ cd ../..
#==============================================================================#
startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml
# We only bump dependencies in the top-level package.json, because workspaces
# already use the workspace: protocol so will get the version in the monorepo
# and not from npm.
node "$PWD"/scripts/integration-tests/utils/bump-babel-dependencies.js
# Install dependencies in individual packages so that we can link them at the top level.
# todo: remove `-- -- --ignore-engines` in Babel 8
for package in eslint/*/; do yarn --ignore-engines --cwd $package; done
yarn upgrade --scope @babel
# Test
make test-ci
# Update deps, build and test
make -j test-ci
cleanup

View File

@@ -21,13 +21,28 @@ cd tmp/create-react-app || exit
# TEST #
#==============================================================================#
# !!! WARNING !!!
# create-react-app uses the useBuiltIns: true option of @babel/preset-react,
# removed in Babel 8.0.0. And it does not specify runtime option. The test will break on
# runtime: "automatic", default of Babel 8.
# This change replaces useBuiltIns: true with runtime: "classic"
sed -i 's/useBuiltIns: true/runtime: "classic"/' packages/babel-preset-react-app/create.js
bump_deps="$PWD/../../utils/bump-babel-dependencies.js"
node "$bump_deps"
for d in ./packages/*/
do
(cd "$d"; node "$bump_deps")
done
# Don't use Yarn 2
export YARN_IGNORE_PATH=1
startLocalRegistry "$PWD"/../../verdaccio-config.yml
yarn install
node "$PWD"/../../utils/bump-babel-dependencies.js
yarn lerna exec -- node "$PWD"/../../utils/bump-babel-dependencies.js
yarn install
# Test
CI=true yarn test
unset YARN_IGNORE_PATH
cleanup

View File

@@ -21,6 +21,9 @@ cd tmp/vue-cli || exit
# TEST #
#==============================================================================#
# Don't use Yarn 2
export YARN_IGNORE_PATH=1
startLocalRegistry "$PWD"/../../verdaccio-config.yml
yarn install
node "$PWD"/../../utils/bump-babel-dependencies.js
@@ -30,4 +33,5 @@ yarn install
# Test
CI=true yarn test -p babel,babel-preset-app
unset YARN_IGNORE_PATH
cleanup

View File

@@ -23,7 +23,7 @@ initializeE2Egit
# PUBLISH #
#==============================================================================#
make -j bootstrap-only
yarn
startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml
loginLocalRegistry

View File

@@ -7,7 +7,7 @@ const content = JSON.parse(fs.readFileSync(packageJSONPath));
let bumped = false;
function bumpBabelDependency(dependencies) {
for (const dep of Object.keys(dependencies)) {
if (dep.startsWith("@babel/")) {
if (dep.startsWith("@babel/") && !dependencies[dep].includes(":")) {
dependencies[dep] = "latest";
bumped = true;
}

View File

@@ -3,8 +3,6 @@
# Copied from https://github.com/facebook/create-react-app/blob/053f9774d3f592c17741d2a86de66a7ca58f90c0/tasks/local-registry.sh
custom_registry_url=http://localhost:4873
original_npm_registry_url=`npm get registry`
original_yarn_registry_url=`yarn config get registry`
default_verdaccio_package=verdaccio@~4.3.3
function startLocalRegistry {
@@ -17,18 +15,20 @@ function startLocalRegistry {
grep -q "http address" <(tail -f $tmp_registry_log)
# Set registry to local registry
npm set registry "$custom_registry_url"
yarn config set registry "$custom_registry_url"
export NPM_CONFIG_REGISTRY="$custom_registry_url"
export YARN_NPM_PUBLISH_REGISTRY="$custom_registry_url"
export YARN_NPM_REGISTRY_SERVER="$custom_registry_url"
export YARN_NPM_AUTH_IDENT="username:password"
}
function loginLocalRegistry {
# Login so we can publish packages
(cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url")
export YARN_NPM_AUTH_IDENT="username:password"
}
function stopLocalRegistry {
# Restore the original NPM and Yarn registry URLs and stop Verdaccio
fuser -k 4873/tcp
npm set registry "$original_npm_registry_url"
yarn config set registry "$original_yarn_registry_url"
unset NPM_CONFIG_REGISTRY
unset YARN_NPM_PUBLISH_REGISTRY
unset YARN_NPM_REGISTRY_SERVER
}