Skip to content

Commit

Permalink
Update Yarn to v4 (#82688)
Browse files Browse the repository at this point in the history
* Update to Yarn 4.0.2

* chore: add missing `-A` param to `yarn workspaces foreach` call

* Update engines field

* Update log ignore patterns

* Add script to rebuild packages during yarn build if needed

---------

Co-authored-by: Markus Dobmann <[email protected]>
  • Loading branch information
noahtallen and flootr authored Nov 18, 2023
1 parent ff1b732 commit 6aaedd0
Show file tree
Hide file tree
Showing 10 changed files with 8,527 additions and 8,461 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/editing-toolkit-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- name: Build packages
if: steps.cache.outputs.cache-hit == 'true'
run: yarn workspaces foreach --parallel --verbose run postinstall # Needed only when not running yarn install.
run: yarn workspaces foreach --all --parallel --verbose run postinstall # Needed only when not running yarn install.

- name: Build JavaScript
run: yarn build
Expand Down
2 changes: 1 addition & 1 deletion .teamcity/_self/projects/WPComPlugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ object CalypsoApps: BuildType({
export build_number="%build.number%"
export commit_sha="%build.vcs.number%"
yarn workspaces foreach --verbose --parallel --include "{${'$'}apps}" run teamcity:build-app
yarn workspaces foreach --all --verbose --parallel --include "{${'$'}apps}" run teamcity:build-app
"""
}

Expand Down
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.3.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

32 changes: 3 additions & 29 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,10 @@
compressionLevel: 0
nodeLinker: node-modules
enableGlobalCache: true
preferAggregateCacheInfo: true
yarnPath: .yarn/releases/yarn-3.2.3.cjs

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
yarnPath: .yarn/releases/yarn-4.0.2.cjs

### Log filters to discard irrelevant warnings. ###
logFilters:
# The fsevents warning is useless, so discard it:
- level: discard
pattern: "fsevents@*/* The * architecture is incompatible with this module, link skipped."

# Newspack blocks has many transitive dependencies without React 18 explicitly supported, so we need to ignore those.
- level: discard
pattern: "@automattic/wpcom-editing-toolkit@workspace:apps/editing-toolkit provides +(react|react-dom) (*) with version 18.2.0, which doesn't satisfy what @automattic/newspack-blocks and some of its descendants request"

# WordPress packages often have transitive dependencies with incorrect react-related peer dependencies.
# This matcher discards those log messages, while allowing non-react or non-wordpress related violations
# to be handled separately. (For example, npm packages can be handled via packageExtensions.)
Expand All @@ -37,24 +24,11 @@ logFilters:
# 3. Match a react or react-dom on the current version which a workspace package provides.
# 4. Match only violations coming from within @wordpress packages.
- level: discard
pattern: "**@workspace:+(client|*/*|.) provides +(react|react-dom) (*) with version 18.2.0, which doesn't satisfy what +(@wordpress/*|@types/wordpress__*) and some of its descendants request"
pattern: "+(react|react-dom) is listed by your project with version 18.2.0, which doesn't satisfy what +(@wordpress/*|@types/wordpress__*) and other dependencies request*"

# TODO: Remove this once Reakit can be removed (or once Reakit includes React 18 as a peer dependency.)
- level: discard
pattern: "calypso@workspace:client provides +(react|react-dom) (*) with version 18.2.0, which doesn't satisfy what reakit and some of its descendants request"

# TODO: Remove this once the react-autosize-textarea transitive dependency has been fixed/updated to a version with React 18 support.
- level: discard
pattern: "calypso@workspace:client provides +(react|react-dom) (*) with version 18.2.0, which doesn't satisfy what @automattic/block-renderer and some of its descendants request"

# React day picker version 7 does not include explicit react 18 support, but we can't update to v8 just yet.
# TODO: Remove after updating to react-day-picker version 8.
- level: discard
pattern: "calypso@workspace:client provides react (*) with version 18.2.0, which doesn't satisfy what react-day-picker requests"

# TODO: Remove after the `preact` dependency version has beem bumped in `@wordpress/interactivity.
- level: discard
pattern: "@wordpress/interactivity@npm:2.5.0 provides preact (*) with version 10.15.1, which doesn't satisfy what deepsignal requests"
pattern: "react-dom is listed by your project with version 18.2.0, which doesn't satisfy what reakit*"

### Package extensions to provide missing peer dependencies. ###
packageExtensions:
Expand Down
10 changes: 10 additions & 0 deletions bin/build-packages-if-needed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# yarn start fails when this package is not built. It a good indication that the
# prerequisite packages were cleaned and need to be prepared again.
if [ ! -d "packages/create-calypso-config/dist" ] ; then
echo "Building packages..."
yarn workspaces foreach --all --parallel --verbose run prepare
else
echo "Packages are built."
fi
2 changes: 1 addition & 1 deletion bin/unit-test-suite.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const testApps = withUnitTestInfo( 'test-apps --maxWorkers=1' );

const testWorkspaces = {
name: 'yarn',
args: 'workspaces foreach --verbose --parallel run storybook --ci --smoke-test',
args: 'workspaces foreach -A --verbose --parallel run storybook --ci --smoke-test',
testId: 'check_storybook',
};

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
},
"engines": {
"node": "^v20.8.1",
"yarn": "^3.1.1"
"yarn": "^4.0.0"
},
"scripts": {
"analyze-bundles": "yarn run build-client-stats && webpack-bundle-analyzer client/stats.json public/evergreen -h 127.0.0.1 -p 9898 -s gzip",
"analyze-bundles:server": "yarn run build-server-stats && webpack-bundle-analyzer client/stats-server.json build -h 127.0.0.1 -p 9898 -s parsed",
"analyze-icfy": "yarn run build-client-stats && node --max-old-space-size=4096 bin/icfy-analyze.js",
"build": "yarn run build-static && yarn run build-css && run-p -s 'build-devdocs:*' && run-p -s build-server build-client-if-prod",
"build": "./bin/build-packages-if-needed.sh && yarn run build-static && yarn run build-css && run-p -s 'build-devdocs:*' && run-p -s build-server build-client-if-prod",
"build-client": "BROWSERSLIST_ENV=evergreen yarn webpack --config client/webpack.config.js --stats-preset errors-only",
"build-client-if-prod": "node -e \"process.env.CALYPSO_ENV === 'production' && process.exit(1)\" || { yarn run build-client && yarn run build-languages-if-enabled }",
"build-client-stats": "NODE_ENV=production CALYPSO_ENV=production EMIT_STATS=true yarn run build-client",
Expand Down Expand Up @@ -387,7 +387,7 @@
"@wordpress/widgets": "3.21.0",
"@wordpress/wordcount": "3.44.0"
},
"packageManager": "yarn@3.2.3",
"packageManager": "yarn@4.0.2",
"dependenciesMeta": {
"@react-spring/[email protected]": {
"built": false
Expand Down
Loading

0 comments on commit 6aaedd0

Please sign in to comment.