-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: when initializing the Configuration
, auto fetch the missing plugins
#4912
feat: when initializing the Configuration
, auto fetch the missing plugins
#4912
Conversation
yarn install
to fetch missing pluginsyarn install
also fetch missing plugins
95379ea
to
15dccb1
Compare
Thanks for tackling this! It's been a longstanding issue, I'd be nice to find a solution. In terms of design, a couple of comments:
So what I'm thinking is, couldn't we rather fetch the missing plugins while instantiating the main configuration? Perhaps even transparently, to avoid messing with the |
I'm really glad to hear that😀.
You're right, I don't like this approach either, but after trying for a long time, I couldn't find a better direction, so I had to leave a long comment in my poor English😢.
This is my first attempt to try to solve this issue: 6062beb (in my fork) This is similar to what you said, I think this code affects less scope and the user experience will be great because the user doesn't even need to run But I'm not sure if it's good semantics to fetch missing plugins over the network when initializing Configuration. If you like this approach, I can refactor this PR in this direction😀. |
15dccb1
to
61681cd
Compare
yarn install
also fetch missing pluginsConfiguration
, auto fetch the missing plugins
61681cd
to
c916600
Compare
hi @arcanis I tried to follow the direction you mentioned but found that my test was broken( This made me realize that when I fetch the missing plugins via "configuration", I haven't loaded any network and HTTP settings in yarnrc yet. Do you think it's a good direction to load all yarnrc settings before loading all third-party plugins? I'm not sure if this will cause some third-party plugins to break😢. |
c916600
to
ffd7257
Compare
Yes, ideally we should load the core settings before the plugin ones. That's important for the proxy, but also for |
1c96c0d
to
a206c93
Compare
I change the loading order in this commit 0c3221d before:
after:
Now it works well 😀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to do this we need to have a checksum of the plugin in .yarnrc.yml
so we can ensure the plugin didn't change.
After some thought, if we want the third-party plugins to have checksum too, I realized that yarn third-party plugins are almost a devDependency🤔. Maybe we should manage third-party plugins as a dependency. I have thought of some advantages and disadvantages AdvantagesThird Party Plugin Developers
Users
Yarn Teams
Disadvantages
|
That'd be a fairly complex undertaking, since plugins need to be installed for packages to be fetched. I think we should remain simple. |
OK, then I will try to add plugin checksum to the RC file |
2a3f021
to
dc8d550
Compare
If there is anything missing, please feel free to talk to me! |
dc8d550
to
e5fc815
Compare
3ea2669
to
e5fc815
Compare
…n exists and try to fetch the missing plugins
…tching the plugin
…sum does not match
cdacf49
to
724ba5c
Compare
Can you please help me find in which version was this feature released? 🙏 |
Can we please cherry-pick this to v3.x version? I can't wait to v4 release 😢 |
What's the problem this PR addresses?
Closes #4464
When the user loses the
.yarn/plugins
directory, all yarn commands will fail....
How did you fix it?
1. I changed the loading order of the
Configuration
0c3221dreason
2. when initializing the Configuration, check if the plugin exists and try to fetch the missing plugins 1c5c3a0
3. test 90a8e97 ead886a
...
Additional attempts
jj811208#4
...
Checklist