š Breaking changes for Yarn 3
See original GitHub issueThis issue is just there to keep track of which changes we might want to do once weāll get to the next major release. Doesnāt mean itāll be anytime soon, the current plan is early 2021 š
-
Important: Deprecate implicit
node-gyp
dependencies and builds. Prefer explicitly listingnode-gyp
in your dependencies, and settingnode-gyp build
in yourpostinstall
script. -
Important: Deprecate the implicit unplug detection based on the package content (for example if the package contains
*.jar
or*.node
libraries). Prefer explicitly setting thepreferUnplugged
field in your package instead. This wonāt affect packages with postinstall scripts, which will still be unplugged by default.
Those two changes put together will allow us to make the install faster by not having to read the package archive at each and every install just to know whether we need to run build scripts or not. Theyāll also make the ecosystem easier to work with, as third-party tools will just have to look at a package metadata to know whether they would trigger postinstall scripts, or would be written on disk. Currently, there isnāt any good way apart from running an actual install and see what happens, or reimplementing the exact same heuristics.
-
Add dependency injection to our hook system
-
Remove support for
initLicense
andinitAuthor
, since they got replaced byinitFields
which does the same thing plus extra. (https://github.com/yarnpkg/berry/pull/2264) -
Refactor the hooks to avoid the proliferation of arguments (instead pack them into a single object argument).
-
Refactor the hooks to use reducers where it would make sense (e.g.
beforeWorkspacePacking
). -
Should
yarn workspaces foreach
execute on all workspaces by default (currently-a
) and be scoped with an option? Rational:āI never saw monorepo that have packages that contained other packages so having -a enabled by default could be a sensible proposalā
-
Merge
build-state.yml
intoinstall-state.gz
(https://github.com/yarnpkg/berry/pull/2574) -
Remove the
yarn policies set-version
alias. (https://github.com/yarnpkg/berry/pull/2370) -
Remove all the environment-specific overrides in
yarn install
. -
Remove the ādefault protocolā concept. It was initially meant to allow building Yarn as package manager for other languages, but even once we get there itās unlikely anyone will change the default protocol (nor that it would be a good idea).
-
Stop supporting TypeScript for version older than 4.0. Building their repository is a huge PITA because they somehow seem to be anti-lockfile, so you cannot install the dependencies they were using at the time. Weāre currently trying to support the whole 3.x branch, but we still have some holes were we canāt find commits that actually build.
-
Always use
.pnp.cjs
(instead of.pnp.js
), even when not using"type": "module"
. (https://github.com/yarnpkg/berry/pull/2286)Motivation, quoting @bgotink.
Right now we store the PnP file as `.pnp.js` for regular workspaces, and as `.pnp.cjs` for workspaces marked `type=module`. There are some downsides to this approach: - This leads to quite a bit of if-checks in yarn itself (generation fo the pnp file, the NODE_OPTIONS environment variable and pnpify). - If there are external tools that depend on the `.pnp.js` file, they will need to also check for `.pnp.cjs`. - This makes switching from one to the other more painful than it needs to be, because you need to run `yarn && yarn pnpify --sdk` and reload your IDE. Always using `.pnp.cjs` removes these downsides.
-
Remove warning and stop deleting the old PnPify SDK folder -
.vscode/pnpify
(https://github.com/yarnpkg/berry/pull/2281) -
Make Yarn imply
--immutable
when used on CI (#2530) -
Rename
master
intomain
-
Remove the
-a
flag fromyarn workspaces foreach
(deprecated in favour of-A
) (https://github.com/yarnpkg/berry/pull/2282) -
Change
packageExtensions
so that it doesnāt, by default, replaces existing entries (so for example, if you addlodash
as dependency towebpack
, ifwebpack
actually lists lodash, then weāll prefer using the range it originally requests). However, if you set!important
at the end of the range, weāll use your range over the original one. -
Make portals only connect the regular dependencies, not the dev ones (perhaps add support for the dev ones with a protocol flag, like
portal:path/to/dir#dev
?) (https://github.com/yarnpkg/berry/pull/1971) -
Make all settings mergeable, and provide a
reset: true
syntax when they need to be a full override. -
Look at how settings are inherited from the global scope to the local one. (https://github.com/yarnpkg/berry/issues/2106, https://github.com/yarnpkg/berry/pull/2116)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:46
- Comments:7 (6 by maintainers)
Just found this, looks really good! One remark though on this:
That makes sense from a yarn dx point of view. But from a runtime / installtime performance if might cause problems. On large monorepos it seems like these functions might be called a lot and passing single object arguments means allocating a lot of single-use objects, creating a lot of GC churn. Not sure of the real life impact, but from my point of view, runtime performance of yarn is an important aspect to keep in mind
We donāt have a topic for the breaking changes we plan to make in Yarn 4 yet. The items we havenāt worked on are mostly split into the ātoo disruptive for too little gainā and ānot enough time to work on them in a reasonable timeframeā; the later will probably be addressed in the next major, the former isnāt decided yet.