Description
openedon May 17, 2022
- I'd be willing to implement this feature (contributing guide)
- This feature is important to have in this repository; a contrib plugin wouldn't do
Describe the user story
Some projects don't include the plugins directory or even the whole .yarn directory in their git repo. When you run any yarn command you get an error. It could also happen if the plugins directory or .yarn directory gets deleted for some reason.
Internal Error: Cannot find module '.yarn/plugins/@yarnpkg/plugin-outdated.cjs'
Require stack:
- yarn/3.2.1/yarn.js
Require stack:
- yarn/3.2.1/yarn.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (/usr/lib/node_modules/corepack/dist/vcc.js:170:20)
at wJ (yarn/3.2.1/yarn.js:395:12617)
at Ng (yarn/3.2.1/yarn.js:395:13471)
at k (yarn/3.2.1/yarn.js:396:21561)
at Function.find (yarn/3.2.1/yarn.js:396:22173)
at async i (yarn/3.2.1/yarn.js:449:11336)
at async r (yarn/3.2.1/yarn.js:449:10914)
Describe the solution you'd like
.yarnrc.yml
already has all the information it needs to install all plugins. It should do that when running yarn install
so that anyone setting up a new project gets all the plugins they need and not an error.
It's like how corepack uses packageManager in package.json to automatically get that version of yarn when it doesn't exist. It wouldn't make much sense for it to fail and say that it can't find that version of yarn when it has all the information it needs to install it.
Describe the drawbacks of your solution
There shouldn't be a problem for people who already have the plugins installed since it can check which ones exist and skip those.
Describe alternatives you've considered
I could parse the yarnrc file and run yarn plugin import
for each of them but it makes sense for it to be in yarn so everyone can have a smoother experience working with a new project. It also makes it more reliable when onboarding new contributors.