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/ci.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2019-08-30 23:55:17 +0300
committerisaacs <i@izs.me>2019-08-31 08:19:32 +0300
commitcebf542e61dcabdd2bd3b876272bf8eebf7d01cc (patch)
tree79bdbfb4bc673d5f29c99bcf17f132680774ddaf /lib/ci.js
parent23ce65616c550647c586f7babc3c2f60115af2aa (diff)
ci: pass appropriate configs for file/dir modes
Re: https://npm.community/t/6-11-2-npm-ci-installs-package-with-wrong-permissions/9720 Still passing a plain old (non-Figgy Pudding) object into libcipm, duplicating the extra keys added in figgy-config.js. This is not a clean or nice or elegant solution, but it works, without regressing the config env var issue. Pairing with @claudiahdz PR-URL: https://github.com/npm/cli/pull/243 Credit: @isaacs Close: #243 Reviewed-by: @claudiahdz
Diffstat (limited to 'lib/ci.js')
-rw-r--r--lib/ci.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/ci.js b/lib/ci.js
index 375c1448a..309ad2f78 100644
--- a/lib/ci.js
+++ b/lib/ci.js
@@ -2,7 +2,8 @@
const npm = require('./npm.js')
const Installer = require('libcipm')
-const npmlog = require('npmlog')
+const log = require('npmlog')
+const path = require('path')
ci.usage = 'npm ci'
@@ -10,14 +11,33 @@ ci.completion = (cb) => cb(null, [])
module.exports = ci
function ci (args, cb) {
- const opts = Object.create({ log: npmlog })
+ const opts = {
+ // Add some non-npm-config opts by hand.
+ cache: path.join(npm.config.get('cache'), '_cacache'),
+ // NOTE: npm has some magic logic around color distinct from the config
+ // value, so we have to override it here
+ color: !!npm.color,
+ hashAlgorithm: 'sha1',
+ includeDeprecated: false,
+ log,
+ 'npm-session': npm.session,
+ 'project-scope': npm.projectScope,
+ refer: npm.referer,
+ dmode: npm.modes.exec,
+ fmode: npm.modes.file,
+ umask: npm.modes.umask,
+ npmVersion: npm.version,
+ tmp: npm.tmp
+ }
+
for (const key in npm.config.list[0]) {
if (key !== 'log') {
opts[key] = npm.config.list[0][key]
}
}
+
return new Installer(opts).run().then(details => {
- npmlog.disableProgress()
+ log.disableProgress()
console.log(`added ${details.pkgCount} packages in ${
details.runTime / 1000
}s`)