Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Yarn Modern v4 #6446

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
6 changes: 3 additions & 3 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
node-version: 'lts/iron'
cache: 'yarn'

- run: yarn install --production=false --frozen-lockfile --ignore-scripts
- run: yarn install --immutable
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--frozen-lockfile is replaced by --immutable. This means the install will abort with an error exit code if the lockfile was to be modified by installing third party libraries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--ignore-scripts is replaced by enableScripts: false in .yarnrc.yml. This disables post-installation scripts from third party libraries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--production=false was originally used to ensure devDeps were not installed during ci-builds. However, it's not a flag that applies to Yarn Modern, and Yarn will not install any package listed in devDependencies if the NODE_ENV environment variable is set to production, which is the case in many of our build scripts anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out that --immutable always installs all dependencies. An install can't be limited to production dependencies without changing the lockfile: yarnpkg/berry#2253 (comment)

--production=false should have ensured that devDeps were installed, though. Otherwise the subsequent build would fail, without the build tools.

- run: yarn workspace @zooniverse/react-components build:es6
- run: yarn workspace @zooniverse/classifier build:es6
- run: yarn workspace @zooniverse/fe-project build
Expand All @@ -39,7 +39,7 @@ jobs:
node-version: 'lts/iron'
cache: 'yarn'

- run: yarn install --production=false --frozen-lockfile --ignore-scripts
- run: yarn install --immutable
- run: yarn workspace @zooniverse/react-components build:es6
- run: yarn workspace @zooniverse/content build:es6
- run: yarn workspace @zooniverse/user build:es6
Expand All @@ -58,7 +58,7 @@ jobs:
node-version: 'lts/iron'
cache: 'yarn'

- run: yarn install --production=false --frozen-lockfile --ignore-scripts
- run: yarn install --immutable
- run: yarn workspace @zooniverse/react-components build:es6
- run: yarn workspace @zooniverse/content build:es6
- run: yarn workspace @zooniverse/user build:es6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
node-version: 'lts/iron'
cache: 'yarn'

- run: yarn install --production=false --frozen-lockfile --ignore-scripts
- run: yarn install --immutable
- run: yarn workspace @zooniverse/react-components build:cjs
- run: yarn workspace @zooniverse/user build:cjs
- run: yarn workspace @zooniverse/subject-viewers build:cjs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
node-version: 'lts/iron'
cache: 'yarn'

- run: yarn install --production=false --frozen-lockfile
- run: yarn install --immutable
- run: yarn workspace @zooniverse/react-components build:es6
- name: Deploy to GH Pages
run: yarn deploy-storybook -- --ci
Expand Down
39 changes: 11 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Based on https://github.com/github/gitignore/blob/master/Node.gitignore
# Yarn https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This root .gitignore file was generated years ago and contained a lot of "extras" that don't apply to FEM. I've cleaned it up and included the recommended Yarn files.

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Yarn Integrity file
.yarn-integrity

# Logs
logs
Expand Down Expand Up @@ -27,12 +37,6 @@ coverage
# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

Expand All @@ -43,12 +47,6 @@ build/Release
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

Expand All @@ -61,9 +59,6 @@ typings/
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
Expand All @@ -74,21 +69,9 @@ typings/
# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Repo build artifacts
dist

Expand Down
Loading