Skip to content

feat: add support for .corepack.env - #642

Merged
aduh95 merged 11 commits into
nodejs:mainfrom
aduh95:corepack-dot-env
Feb 28, 2025
Merged

feat: add support for .corepack.env#642
aduh95 merged 11 commits into
nodejs:mainfrom
aduh95:corepack-dot-env

Conversation

@aduh95

@aduh95aduh95 commented Feb 8, 2025

Copy link
Copy Markdown
Contributor

This would allow project author to customize the behavior of Corepack – with the recent incident related to npm registry key rotation, it show how it would be useful to override the built-in values. It could also be used to disable auto pinning at a project level.

It's also a first step towards allowing specifying ranges in the package.json (see #634), which has been requested for a long long time (#95).

Fixes: #628

@styfle

Copy link
Copy Markdown
Member

I'm not sure about this feature.

Adding a config file sounds like increased complexity for very little benefit.

Do you have examples of when you might use this?

@aduh95

Copy link
Copy Markdown
ContributorAuthor

Do you have examples of when you might use this?

The tests in this PR as well as in #634 are good examples I think

@aduh95

Copy link
Copy Markdown
ContributorAuthor

And #628 of course

Comment threadREADME.md Outdated
Comment on lines +298 to +300
Only keys that starts with `COREPACK_` will be taken into account, not all
keys that start with `COREPACK_` will be taken into account (
`COREPACK_ENABLE_DOWNLOAD_PROMPT` and `COREPACK_ENV_FILE` are ignored).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be worth a test, especially for COREPACK_ENABLE_DOWNLOAD_PROMPT (assuming you omitted it for security reasons?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call (yes, btw I’m happy to add more which we think could be security sensitive)

@aduh95
aduh95 requested a review from arcanisFebruary 15, 2025 19:08
Comment threadREADME.md Outdated
Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
Comment threadREADME.md Outdated
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COREPACK_ENABLE_AUTO_PIN should be possible to set on a project level

4 participants

@aduh95@styfle@arcanis@MikeMcC399