diff options
Diffstat (limited to 'deps/npm/lib/config')
-rw-r--r-- | deps/npm/lib/config/cmd-list.js | 11 | ||||
-rw-r--r-- | deps/npm/lib/config/core.js | 34 | ||||
-rw-r--r-- | deps/npm/lib/config/defaults.js | 18 | ||||
-rw-r--r-- | deps/npm/lib/config/fetch-opts.js | 12 | ||||
-rw-r--r-- | deps/npm/lib/config/get-credentials-by-uri.js | 6 | ||||
-rw-r--r-- | deps/npm/lib/config/load-prefix.js | 2 | ||||
-rw-r--r-- | deps/npm/lib/config/pacote.js | 2 | ||||
-rw-r--r-- | deps/npm/lib/config/set-credentials-by-uri.js | 2 |
8 files changed, 50 insertions, 37 deletions
diff --git a/deps/npm/lib/config/cmd-list.js b/deps/npm/lib/config/cmd-list.js index 49c445a4f0..2069b5ea33 100644 --- a/deps/npm/lib/config/cmd-list.js +++ b/deps/npm/lib/config/cmd-list.js @@ -4,8 +4,10 @@ var shorthands = { 'rb': 'rebuild', 'list': 'ls', 'ln': 'link', + 'create': 'init', 'i': 'install', 'it': 'install-test', + 'cit': 'install-ci-test', 'up': 'update', 'c': 'config', 's': 'search', @@ -22,6 +24,8 @@ var affordances = { 'la': 'ls', 'll': 'ls', 'verison': 'version', + 'ic': 'ci', + 'innit': 'init', 'isntall': 'install', 'dist-tags': 'dist-tag', 'apihelp': 'help', @@ -41,11 +45,14 @@ var affordances = { 'remove': 'uninstall', 'rm': 'uninstall', 'r': 'uninstall', - 'rum': 'run-script' + 'rum': 'run-script', + 'sit': 'cit', + 'urn': 'run-script' } // these are filenames in . var cmdList = [ + 'ci', 'install', 'install-test', 'uninstall', @@ -58,6 +65,7 @@ var cmdList = [ 'prune', 'pack', 'dedupe', + 'hook', 'rebuild', 'link', @@ -76,6 +84,7 @@ var cmdList = [ 'shrinkwrap', 'token', 'profile', + 'audit', 'help', 'help-search', diff --git a/deps/npm/lib/config/core.js b/deps/npm/lib/config/core.js index 50cf4772e7..b9851f98d0 100644 --- a/deps/npm/lib/config/core.js +++ b/deps/npm/lib/config/core.js @@ -21,18 +21,20 @@ exports.defs = configDefs Object.defineProperty(exports, 'defaults', { get: function () { return configDefs.defaults -}, enumerable: true }) +}, +enumerable: true }) Object.defineProperty(exports, 'types', { get: function () { return configDefs.types -}, enumerable: true }) +}, +enumerable: true }) exports.validate = validate var myUid = process.env.SUDO_UID !== undefined - ? process.env.SUDO_UID : (process.getuid && process.getuid()) + ? process.env.SUDO_UID : (process.getuid && process.getuid()) var myGid = process.env.SUDO_GID !== undefined - ? process.env.SUDO_GID : (process.getgid && process.getgid()) + ? process.env.SUDO_GID : (process.getgid && process.getgid()) var loading = false var loadCbs = [] @@ -153,17 +155,10 @@ function load_ (builtin, rc, cli, cb) { // annoying humans and their expectations! if (conf.get('prefix')) { var etc = path.resolve(conf.get('prefix'), 'etc') - mkdirp(etc, function () { - defaults.globalconfig = path.resolve(etc, 'npmrc') - defaults.globalignorefile = path.resolve(etc, 'npmignore') - afterUserContinuation() - }) - } else { - afterUserContinuation() + defaults.globalconfig = path.resolve(etc, 'npmrc') + defaults.globalignorefile = path.resolve(etc, 'npmignore') } - } - function afterUserContinuation () { conf.addFile(conf.get('globalconfig'), 'global') // move the builtin into the conf stack now. @@ -274,7 +269,7 @@ Conf.prototype.save = function (where, cb) { if (cb) return cb(er) else return this.emit('error', er) } - this._saving -- + this._saving-- if (this._saving === 0) { if (cb) cb() this.emit('save') @@ -283,7 +278,7 @@ Conf.prototype.save = function (where, cb) { then = then.bind(this) done = done.bind(this) - this._saving ++ + this._saving++ var mode = where === 'user' ? '0600' : '0666' if (!data.trim()) { @@ -331,7 +326,10 @@ Conf.prototype.parse = function (content, file) { Conf.prototype.add = function (data, marker) { try { Object.keys(data).forEach(function (k) { - data[k] = parseField(data[k], k) + const newKey = envReplace(k) + const newField = parseField(data[k], newKey) + delete data[k] + data[newKey] = newField }) } catch (e) { this.emit('error', e) @@ -351,8 +349,8 @@ Conf.prototype.addEnv = function (env) { // leave first char untouched, even if // it is a '_' - convert all other to '-' var p = k.toLowerCase() - .replace(/^npm_config_/, '') - .replace(/(?!^)_/g, '-') + .replace(/^npm_config_/, '') + .replace(/(?!^)_/g, '-') conf[p] = env[k] }) return CC.prototype.addEnv.call(this, '', conf, 'env') diff --git a/deps/npm/lib/config/defaults.js b/deps/npm/lib/config/defaults.js index c049f213fa..8e0d7e4fd5 100644 --- a/deps/npm/lib/config/defaults.js +++ b/deps/npm/lib/config/defaults.js @@ -82,7 +82,7 @@ if (home) process.env.HOME = home else home = path.resolve(temp, 'npm-' + uidOrPid) var cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm' -var cacheRoot = process.platform === 'win32' && process.env.APPDATA || home +var cacheRoot = (process.platform === 'win32' && process.env.APPDATA) || home var cache = path.resolve(cacheRoot, cacheExtra) var globalPrefix @@ -109,6 +109,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { 'allow-same-version': false, 'always-auth': false, also: null, + audit: true, 'auth-type': 'legacy', 'bin-links': true, @@ -130,7 +131,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { cidr: null, - color: true, + color: process.env.NO_COLOR == null, depth: Infinity, description: true, dev: false, @@ -152,7 +153,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'), 'global-style': false, group: process.platform === 'win32' ? 0 - : process.env.SUDO_GID || (process.getgid && process.getgid()), + : process.env.SUDO_GID || (process.getgid && process.getgid()), 'ham-it-up': false, heading: 'npm', 'if-present': false, @@ -193,6 +194,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { 'progress': !process.env.TRAVIS && !process.env.CI, proxy: null, 'https-proxy': null, + 'no-proxy': null, 'user-agent': 'npm/{npm-version} ' + 'node/{node-version} ' + '{platform} ' + @@ -251,6 +253,7 @@ exports.types = { 'allow-same-version': Boolean, 'always-auth': Boolean, also: [null, 'dev', 'development'], + audit: Boolean, 'auth-type': ['legacy', 'sso', 'saml', 'oauth'], 'bin-links': Boolean, browser: [null, String], @@ -312,12 +315,13 @@ exports.types = { 'metrics-registry': [null, String], 'node-options': [null, String], 'node-version': [null, semver], + 'no-proxy': [null, String, Array], offline: Boolean, 'onload-script': [null, String], only: [null, 'dev', 'development', 'prod', 'production'], optional: Boolean, 'package-lock': Boolean, - otp: Number, + otp: [null, String], 'package-lock-only': Boolean, parseable: Boolean, 'prefer-offline': Boolean, @@ -382,9 +386,9 @@ function getLocalAddresses () { return interfaces[nic].filter(function (addr) { return addr.family === 'IPv4' }) - .map(function (addr) { - return addr.address - }) + .map(function (addr) { + return addr.address + }) }).reduce(function (curr, next) { return curr.concat(next) }, []).concat(undefined) diff --git a/deps/npm/lib/config/fetch-opts.js b/deps/npm/lib/config/fetch-opts.js index 1a030c378e..213c293d6c 100644 --- a/deps/npm/lib/config/fetch-opts.js +++ b/deps/npm/lib/config/fetch-opts.js @@ -26,12 +26,12 @@ function fromPacote (opts) { function getCacheMode (opts) { return opts.offline - ? 'only-if-cached' - : opts.preferOffline - ? 'force-cache' - : opts.preferOnline - ? 'no-cache' - : 'default' + ? 'only-if-cached' + : opts.preferOffline + ? 'force-cache' + : opts.preferOnline + ? 'no-cache' + : 'default' } function getHeaders (uri, registry, opts) { diff --git a/deps/npm/lib/config/get-credentials-by-uri.js b/deps/npm/lib/config/get-credentials-by-uri.js index d04f6137de..5e672696b2 100644 --- a/deps/npm/lib/config/get-credentials-by-uri.js +++ b/deps/npm/lib/config/get-credentials-by-uri.js @@ -40,14 +40,14 @@ function getCredentialsByURI (uri) { var userDef = this.get('username') var passDef = this.get('_password') if (authDef && !(userDef && passDef)) { - authDef = new Buffer(authDef, 'base64').toString() + authDef = Buffer.from(authDef, 'base64').toString() authDef = authDef.split(':') userDef = authDef.shift() passDef = authDef.join(':') } if (this.get(nerfed + ':_password')) { - c.password = new Buffer(this.get(nerfed + ':_password'), 'base64').toString('utf8') + c.password = Buffer.from(this.get(nerfed + ':_password'), 'base64').toString('utf8') } else if (nerfed === defnerf && passDef) { c.password = passDef } @@ -65,7 +65,7 @@ function getCredentialsByURI (uri) { } if (c.username && c.password) { - c.auth = new Buffer(c.username + ':' + c.password).toString('base64') + c.auth = Buffer.from(c.username + ':' + c.password).toString('base64') } return c diff --git a/deps/npm/lib/config/load-prefix.js b/deps/npm/lib/config/load-prefix.js index c2af00c7f6..090865d215 100644 --- a/deps/npm/lib/config/load-prefix.js +++ b/deps/npm/lib/config/load-prefix.js @@ -34,7 +34,7 @@ function loadPrefix (cb) { Object.defineProperty(this, 'localPrefix', { set: function (prefix) { p = prefix }, get: function () { return p }, - enumerable: true }) + enumerable: true }) // try to guess at a good node_modules location. // If we are *explicitly* given a prefix on the cli, then diff --git a/deps/npm/lib/config/pacote.js b/deps/npm/lib/config/pacote.js index ec43178c77..b9c651d883 100644 --- a/deps/npm/lib/config/pacote.js +++ b/deps/npm/lib/config/pacote.js @@ -26,6 +26,7 @@ function pacoteOpts (moreOpts) { defaultTag: npm.config.get('tag'), dirPacker: pack.packGitDep, hashAlgorithm: 'sha1', + includeDeprecated: false, key: npm.config.get('key'), localAddress: npm.config.get('local-address'), log: log, @@ -37,6 +38,7 @@ function pacoteOpts (moreOpts) { preferOnline: npm.config.get('prefer-online') || npm.config.get('cache-max') <= 0, projectScope: npm.projectScope, proxy: npm.config.get('https-proxy') || npm.config.get('proxy'), + noProxy: npm.config.get('no-proxy'), refer: npm.registry.refer, registry: npm.config.get('registry'), retry: { diff --git a/deps/npm/lib/config/set-credentials-by-uri.js b/deps/npm/lib/config/set-credentials-by-uri.js index 74211380d8..4723d561a8 100644 --- a/deps/npm/lib/config/set-credentials-by-uri.js +++ b/deps/npm/lib/config/set-credentials-by-uri.js @@ -23,7 +23,7 @@ function setCredentialsByURI (uri, c) { this.del(nerfed + ':_authToken', 'user') - var encoded = new Buffer(c.password, 'utf8').toString('base64') + var encoded = Buffer.from(c.password, 'utf8').toString('base64') this.set(nerfed + ':_password', encoded, 'user') this.set(nerfed + ':username', c.username, 'user') this.set(nerfed + ':email', c.email, 'user') |