diff options
author | Pelle Wessman <pelle@kodfabrik.se> | 2021-10-15 13:51:41 +0300 |
---|---|---|
committer | Luke Karrys <luke@lukekarrys.com> | 2021-10-27 19:37:40 +0300 |
commit | cb9f43551f46bf27095cd7bd6c1885a441004cd2 (patch) | |
tree | 41ffb54786a257a63874181df1f7522908c07745 /tap-snapshots | |
parent | 62c731545e83f3c7f890d6b4feb6f7544884bd3c (diff) |
fix: allow `--lockfile-version` config to be string and coerce to number
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: https://github.com/npm/cli/pull/3949
Credit: @lukekarrys
Close: #3949
Reviewed-by: @isaacs
Diffstat (limited to 'tap-snapshots')
-rw-r--r-- | tap-snapshots/test/lib/utils/config/definitions.js.test.cjs | 2 | ||||
-rw-r--r-- | tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index aaf59e6a2..8c85225f2 100644 --- a/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -1061,7 +1061,7 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for lockf * Default: Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version -* Type: null, 1, 2, or 3 +* Type: null, 1, 2, 3, "1", "2", or "3" Set the lockfile format version to be used in package-lock.json and npm-shrinkwrap-json files. Possible options are: diff --git a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index dc55893d0..1ebb33609 100644 --- a/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs +++ b/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -861,7 +861,7 @@ When passed to \`npm config\` this refers to which config file to use. * Default: Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version -* Type: null, 1, 2, or 3 +* Type: null, 1, 2, 3, "1", "2", or "3" Set the lockfile format version to be used in package-lock.json and npm-shrinkwrap-json files. Possible options are: |