-
Notifications
You must be signed in to change notification settings - Fork 173
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
Patching corepack to work with private registries #296
Comments
An alternative would be to standardise the registries so that even yarn is loaded from NPM via the |
Couple of notes:
|
Thanks for taking the time to consider this and reply. I'll get back to you on the bin patching question, but the rest of your suggestions seem fine to me. I originally suggested the config approach because it would avoid these hyper specific env vars which could make it tougher to maintain in the future. These things are always a trade-off and I value your perspective here. One quick question:
What would the effect of this checksum mismatch be? Would it basically cause corepack to re-download a previously downloaded yarn, or would it hard fail for users? |
Co-sign and wanted to say that I'm running into this issue at my workplace.
@arcanis Happy to make a relatively small PR contribution if it would incrementally solve this! |
I think a better way to specify this is to override yarn with a package specifier like |
I believe the first problem with the headers was solved by #314?
I actually just ran into that cause I ran
We definitely need a way to configure those registries without having to patch corepack which is not feasible to do on every dev's machine. |
I would love to see this feature as well. The lack of specifying a custom repository for yarn (including username and password for connecting to the repository) prevents me from using corepack at the moment. |
@mikeduminy The issues reported here were fixed in versions 0.22 and 0.26. Setting a private registry using |
@simonhaenisch The checksum error was fixed in version 0.28 |
TL;DR suggestion: read engine.config from environment vars.
Hi there 👋
Where I work we want to use corepack to manage package manager versions, however we find that we need to patch it in a few ways. I'm hoping we can find a solution that doesn't rely on patching as it leads to more maintenance over time and I believe that many other companies would benefit from solving this.
Default headers
Our private registry expects specific headers.
A simple solution here would be to add an environment variable to be spread onto these headers. WDYT?
Yarn config
Yarn is unique in that it is the only package manager that is not fetched from npm. If it was then we could easily use the
COREPACK_NPM_REGISTRY
environment variable to change this to our private repo. Today we don't have the ability to modify this via env vars.Due to the way our private repo mirrors external repositories we also need to change the location of the bins for yarn 2+. There is no way to address this other than changing our private repo or patching corepack.
Suggestion 1: Allow custom configs
Since the Engine already supports a config being provided, what if we implemented a new environment variable that can point to the location of a custom config:
COREPACK_CONFIG
. This could even be spread onto the default config, thereby allowing users to only change what is needed.Pros:
Cons:
Suggestion 2: Add more env vars
For the registry we could add a yarn specific setting, or allow a more dynamic resolution such as (replacing this part of corepackUtils.installVersion):
This would allow us to specify
COREPACK_YARN_REGISTRY
and open the door to other ones too, such asCOREPACK_PNPM_REGISTRY
. Granted, it is not super clean.Pros:
Cons:
Conclusion
I'm happy to implement any / all of these, but I'd like to first get some feedback on the design.
The text was updated successfully, but these errors were encountered: