-
Notifications
You must be signed in to change notification settings - Fork 12
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
Explore pnpm
and yarn v3
#588
Comments
This article (2022-01) says that import features like go-to-definition are missing from yarn v3. |
Upgrading to yarn berry (v3)I upgraded to yarn v3 using the instruction in this article and was able to successfully build and run the challenge registry after clearing the nx cache.
TODO:
|
BenchmarkHardware
Yarn 1.22.19Install: $ hyperfine --warmup 1 --prepare 'rm -fr node_modules' --runs 5 'rm -fr yarn.lock && yarn install'
Benchmark 1: rm -fr node_modules && rm -fr yarn.lock && yarn install
Time (mean ± σ): 86.102 s ± 5.088 s [User: 68.002 s, System: 61.143 s]
Range (min … max): 81.725 s … 93.151 s 5 runs Install with lock file: $ hyperfine --warmup 1 --prepare 'rm -fr node_modules' --runs 5 'yarn install --frozen-lockfile'
Benchmark 1: rm -fr node_modules && yarn install --frozen-lockfile
Time (mean ± σ): 63.509 s ± 2.573 s [User: 63.028 s, System: 60.387 s]
Range (min … max): 59.299 s … 65.834 s 5 runs Install the package $ hyperfine --prepare 'yarn remove colors' --runs 5 'yarn add colors'
Benchmark 1: yarn add colors
Time (mean ± σ): 19.879 s ± 0.108 s [User: 19.846 s, System: 18.475 s]
Range (min … max): 19.753 s … 20.035 s 5 runs Yarn 3.2.2Install: $ hyperfine --warmup 1 --prepare 'rm -fr node_modules' --runs 5 ' rm -fr yarn.lock && yarn install'
Benchmark 1: rm -fr node_modules && rm -fr yarn.lock && yarn install
Time (mean ± σ): 52.966 s ± 1.156 s [User: 66.253 s, System: 33.588 s]
Range (min … max): 51.778 s … 54.747 s 5 runs Install with lock file: $ hyperfine --warmup 1 --prepare 'rm -fr node_modules' --runs 5 'yarn install --immutable'
Benchmark 1: rm -fr node_modules && yarn install --immutable
Time (mean ± σ): 38.957 s ± 5.146 s [User: 47.455 s, System: 34.421 s]
Range (min … max): 35.419 s … 47.780 s 5 runs Install the package $ hyperfine --prepare 'yarn remove colors' --runs 5 'yarn add colors'
Benchmark 1: yarn add colors
Time (mean ± σ): 5.356 s ± 0.040 s [User: 5.953 s, System: 0.789 s]
Range (min … max): 5.307 s … 5.409 s 5 runs |
Switching between Yarn versionsvscode@ade7130aff68:/workspaces/challenge-registry$ yarn set version 1.22.17
➤ YN0000: Retrieving https://github.com/yarnpkg/yarn/releases/download/v1.22.17/yarn-1.22.17.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-1.22.17.cjs
➤ YN0000: Done in 1s 330ms
vscode@ade7130aff68:/workspaces/challenge-registry$ yarn set version 1.22.19
Resolving 1.22.19 to a url...
Downloading https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-1.22.19.js...
Saving it into /workspaces/challenge-registry/.yarn/releases/yarn-1.22.19.cjs...
Updating /workspaces/challenge-registry/.yarnrc...
Done!
vscode@ade7130aff68:/workspaces/challenge-registry$ yarn set version 3.2.2
➤ YN0000: Retrieving https://repo.yarnpkg.com/3.2.2/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-3.2.2.cjs
➤ YN0000: Done in 0s 490ms Global and local yarn versionsvscode@ade7130aff68:/workspaces/challenge-registry$ yarn --version
3.2.2
vscode@ade7130aff68:/workspaces/challenge-registry$ cd ~
vscode@ade7130aff68:~$ yarn --version
1.22.19 |
Install project dependencies with PnP
# This file contains the result of Yarn building a package (challenge@workspace:.)
# Script name: postinstall
Error: EROFS: read-only filesystem, open '/node_modules/.ngcc_lock_file'
at makeError$1 (/workspaces/challenge-registry/.pnp.cjs:33270:24)
at EROFS (/workspaces/challenge-registry/.pnp.cjs:33297:10)
at ZipFS.prepareWriteFile (/workspaces/challenge-registry/.pnp.cjs:35131:13)
at ZipFS.writeFileSync (/workspaces/challenge-registry/.pnp.cjs:35115:53)
at /workspaces/challenge-registry/.pnp.cjs:36197:20
at /workspaces/challenge-registry/.pnp.cjs:36413:60
at ZipOpenFS.getZipSync (/workspaces/challenge-registry/.pnp.cjs:36542:14)
at ZipOpenFS.makeCallSync (/workspaces/challenge-registry/.pnp.cjs:36413:17)
at ZipOpenFS.writeFileSync (/workspaces/challenge-registry/.pnp.cjs:36194:17)
at VirtualFS.writeFileSync (/workspaces/challenge-registry/.pnp.cjs:35527:24) Related:
Yarn 2+ without PnP already provides a significant boost in performance and other improvements over Yarn 1. Further exploration of PnP will be left for another day/task. |
Hi @tschaffter, I am a bit confused by the lack of official documentation -- does the result of this exploration mean nx supports yarn3 (with node-modules) without issues? |
Yes, we successfully migrated this Nx workspace to Yarn 2+ three weeks ago. Another team in our org then tried to migrate their non-nx project to Yarn 2+ and bumped into a couple of issues listed below |
Yarn PnP mode (zero install) brought a significant boost in performance in our CI. 15 to 20mn before, 5 to 8mn with PnP, which is a huge improvement. A good chunk of those 5 to 8 minutes is taken by pods waiting to be ready, so even if the code base continues to grows, CI time will not grow as fast. It's a huge incentive towards PnP, and i don't see myself rollback to old node_modules, my teammates would lose their mind. |
@ld210 I need to read more about zero install. While zero install is recommended and used by the Yarn team, it is usually not recommended to track binary and/or large files on Git(Hub) such as the I just gave another try to PnP by removing EDIT: I added $ yarn bin nx
/workspaces/challenge-registry/.yarn/unplugged/nx-virtual-63eb908039/node_modules/nx/bin/nx.js
$ ls /workspaces/challenge-registry/.yarn/unplugged/nx*
/workspaces/challenge-registry/.yarn/unplugged/nx-virtual-5e8d409805:
node_modules
/workspaces/challenge-registry/.yarn/unplugged/nx-virtual-63eb908039:
node_modules |
Interesting discussion related to my previous comment: yarnpkg/berry#180 |
@tschaffter |
Yarn v1 is in maintenance mode since 2020.
yarn v3
andpnpm
are the most promising candidates to replaceyarn v1
. They should also provide a solution to the need (?) to removenode_modules
after a git merge.The text was updated successfully, but these errors were encountered: