Skip to content
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

fix: allow --lockfile-version config to be string and coerce to number #3949

Merged
merged 1 commit into from
Oct 27, 2021

Conversation

lukekarrys
Copy link
Contributor

As all CLI input is considered to be string, eg. a
"npm install --lockfile-version 3" would fail with the error messages:

npm WARN invalid config lockfile-version="3" set in command line options
npm WARN invalid config Must be one of: null, 1, 2, 3

Until we have a config system that supports setting type and possible values
of configs, we have to specify all string and number values for the
lockfile-version, but we coerce all values to numbers in the flattener.

Co-authored-by: @voxpelli
Co-authored-by: @isaacs

@isaacs
Copy link
Contributor

isaacs commented Oct 27, 2021

It's slightly unfortunate that it ends up showing the available values twice in the docs, but it's a tiny nit, and we can address that with the npm v9 config refactor.

@lukekarrys lukekarrys changed the base branch from latest to release-next October 27, 2021 16:27
As all CLI input is considered to be string, eg. a
"npm install --lockfile-version 3" would fail with the error messages:

```
npm WARN invalid config lockfile-version="3" set in command line options
npm WARN invalid config Must be one of: null, 1, 2, 3
```

Until we have a config system that supports setting type and possible values
of configs, we have to specify all string and number values for the
`lockfile-version`, but we coerce all values to numbers in the flattener.

Co-authored-by: @voxpelli
Co-authored-by: @isaacs

PR-URL: #3949
Credit: @lukekarrys
Close: #3949
Reviewed-by: @isaacs
@lukekarrys lukekarrys force-pushed the lk/config-lockfile-version branch from b2c01ea to cb9f435 Compare October 27, 2021 16:39
@lukekarrys lukekarrys merged commit cb9f435 into release-next Oct 27, 2021
@lukekarrys lukekarrys deleted the lk/config-lockfile-version branch October 27, 2021 16:39
@lukekarrys lukekarrys mentioned this pull request Oct 28, 2021
@dominykas
Copy link

dominykas commented Oct 29, 2021

It seems that npm shrinkwrap --lockfile-version=2 no longer shows warnings, but it still produces a v3 shrinkwrap: #3962

ferferga added a commit to jellyfin/jellyfin-vue that referenced this pull request Dec 13, 2021
ThibaultNocchi pushed a commit to jellyfin/jellyfin-vue that referenced this pull request Dec 13, 2021
ferferga added a commit to jellyfin/jellyfin.org that referenced this pull request Sep 6, 2022
* Also enforces a minimum version of 16.13.1 to avoid issues with lockfile v3: npm/cli#3949
Sign up for free to 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.

4 participants