Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2021-03-25 19:46:01 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-03-26 00:42:55 +0300
commit59271936d90fbd6956a41967119f578c0ba63db9 (patch)
tree7d98bef224d0f418432dea96d681bf12ffc9b2b4 /lib
parent1415b4bdeeaabb6e0ba12b6b1b0cc56502bd64ab (diff)
fix(config): tie save-exact/save-prefix together
Each affects the other PR-URL: https://github.com/npm/cli/pull/2965 Credit: @wraithgar Close: #2965 Reviewed-by: @nlf
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/config/definitions.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js
index ec54d731b..512ea8af9 100644
--- a/lib/utils/config/definitions.js
+++ b/lib/utils/config/definitions.js
@@ -1526,7 +1526,10 @@ define('save-exact', {
Dependencies saved to package.json will be configured with an exact
version rather than using npm's default semver range operator.
`,
- flatten,
+ flatten (key, obj, flatOptions) {
+ // just call the save-prefix flattener, it reads from obj['save-exact']
+ definitions['save-prefix'].flatten('save-prefix', obj, flatOptions)
+ },
})
define('save-optional', {
@@ -1595,6 +1598,7 @@ define('save-prefix', {
`,
flatten (key, obj, flatOptions) {
flatOptions.savePrefix = obj['save-exact'] ? '' : obj['save-prefix']
+ obj['save-prefix'] = flatOptions.savePrefix
},
})