nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.61k stars 172 forks source link

feature request: support configuration via config file #510

Open simonhaenisch opened 4 months ago

simonhaenisch commented 4 months ago

Basically to support a ~/.corepackrc file that allows the same config as the COREPACK_ environment variables.

Could be exactly like ~/.npmrc with equivalent npm_config_ env vars, or a yarn-like ~/.corepackrc.yml would also work (I don't care about the format really).

We have a use case for this for automatic machine setup, where adding a config dot-file to the user's home folder is a lot more elegant than modifying their shell's rc file to export extra variables (I generally dislike the idea of automatically modifying user config files).

szimek commented 1 month ago

Any chance of this happening?

We're currently running into an issue where some of our git hook scripts are non-interactive and when Yarn version is upgraded, even though we have the Yarn release .cjs file in the repo, corepack doesn't have it in its own cache and tries to download it. We could disable the prompt using an environment variable, but it's not that straightforward to set it up for everyone locally.