diff options
Diffstat (limited to 'deps/npm/lib/npm.js')
-rw-r--r-- | deps/npm/lib/npm.js | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index f852886433..dbd8e97150 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -38,6 +38,12 @@ var plumbing = require('./config/cmd-list').plumbing var output = require('./utils/output.js') var startMetrics = require('./utils/metrics.js').start + var perf = require('./utils/perf.js') + + perf.emit('time', 'npm') + perf.on('timing', function (name, finished) { + log.timing(name, 'Completed in', finished + 'ms') + }) npm.config = { loaded: false, @@ -54,16 +60,19 @@ // TUNING npm.limit = { fetch: 10, - action: 10 + action: 50 } // *** + npm.lockfileVersion = 1 + npm.rollbacks = [] try { // startup, ok to do this synchronously var j = parseJSON(fs.readFileSync( path.join(__dirname, '../package.json')) + '') + npm.name = j.name npm.version = j.version } catch (ex) { try { @@ -94,7 +103,7 @@ if (!loaded) { throw new Error( 'Call npm.load(config, cb) before using this command.\n' + - 'See the README.md or cli.js for example usage.' + 'See the README.md or bin/npm-cli.js for example usage.' ) } var a = npm.deref(c) @@ -334,8 +343,8 @@ // go ahead and spin up the registry client. lazyProperty(npm, 'registry', function () { registryLoaded = true - var CachingRegClient = require('./cache/caching-client.js') - var registry = new CachingRegClient(npm.config) + var RegClient = require('npm-registry-client') + var registry = new RegClient(adaptClientConfig(npm.config)) registry.version = npm.version registry.refer = registryRefer return registry @@ -458,4 +467,31 @@ return '' } } + + function adaptClientConfig (config) { + return { + proxy: { + http: config.get('proxy'), + https: config.get('https-proxy'), + localAddress: config.get('local-address') + }, + ssl: { + certificate: config.get('cert'), + key: config.get('key'), + ca: config.get('ca'), + strict: config.get('strict-ssl') + }, + retry: { + retries: config.get('fetch-retries'), + factor: config.get('fetch-retry-factor'), + minTimeout: config.get('fetch-retry-mintimeout'), + maxTimeout: config.get('fetch-retry-maxtimeout') + }, + userAgent: config.get('user-agent'), + log: log, + defaultTag: config.get('tag'), + maxSockets: config.get('maxsockets'), + scope: npm.projectScope + } + } })() |