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:00:24 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-03-26 00:41:42 +0300
commit1415b4bdeeaabb6e0ba12b6b1b0cc56502bd64ab (patch)
tree009e2f4027a8fe921fcdf585c4e41315962425ef /lib
parent97b41528739460b2e9e72e09000aded412418cb2 (diff)
fix(config): properly translate user-agent
This config item is a bit of a unique one, as it can be set as a template, but then gets translated and also populated to process.env.npm_config_user_agent. This adds that logic back in during the flattening. PR-URL: https://github.com/npm/cli/pull/2964 Credit: @wraithgar Close: #2964 Reviewed-by: @nlf
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/config/definitions.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js
index 67a830448..ec54d731b 100644
--- a/lib/utils/config/definitions.js
+++ b/lib/utils/config/definitions.js
@@ -1970,6 +1970,11 @@ define('user-agent', {
.replace(/\{arch\}/gi, process.arch)
.replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
.trim()
+ // user-agent is a unique kind of config item that gets set from a template
+ // and ends up translated. Because of this, the normal "should we set this
+ // to process.env also doesn't work
+ obj[key] = flatOptions.userAgent
+ process.env.npm_config_user_agent = flatOptions.userAgent
},
})