diff --git a/lib/fetch-package-metadata.js b/lib/fetch-package-metadata.js index 69ae78e51e3f2..78eed42bdf000 100644 --- a/lib/fetch-package-metadata.js +++ b/lib/fetch-package-metadata.js @@ -8,7 +8,7 @@ const rimraf = require('rimraf') const validate = require('aproba') const npa = require('npm-package-arg') const npm = require('./npm') -const npmConfig = require('./config/figgy-config.js') +let npmConfig const npmlog = require('npmlog') const limit = require('call-limit') const tempFilename = require('./utils/temp-filename') @@ -52,6 +52,9 @@ function fetchPackageMetadata (spec, where, opts, done) { err.code = 'EWINDOWSPATH' return logAndFinish(err) } + if (!npmConfig) { + npmConfig = require('./config/figgy-config.js') + } pacote.manifest(dep, npmConfig({ annotate: true, fullMetadata: opts.fullMetadata, @@ -95,6 +98,9 @@ function addBundled (pkg, next) { } pkg._bundled = null const target = tempFilename('unpack') + if (!npmConfig) { + npmConfig = require('./config/figgy-config.js') + } const opts = npmConfig({integrity: pkg._integrity}) pacote.extract(pkg._resolved || pkg._requested || npa.resolve(pkg.name, pkg.version), target, opts).then(() => { log.silly('addBundled', 'read tarball') diff --git a/lib/install/action/extract.js b/lib/install/action/extract.js index 0e84e157670cf..c1c17cdf6c4f3 100644 --- a/lib/install/action/extract.js +++ b/lib/install/action/extract.js @@ -10,7 +10,7 @@ const moduleStagingPath = require('../module-staging-path.js') const move = require('../../utils/move.js') const npa = require('npm-package-arg') const npm = require('../../npm.js') -const npmConfig = require('../../config/figgy-config.js') +let npmConfig const packageId = require('../../utils/package-id.js') const path = require('path') const localWorker = require('./extract-worker.js') @@ -47,6 +47,9 @@ module.exports = extract function extract (staging, pkg, log) { log.silly('extract', packageId(pkg)) const extractTo = moduleStagingPath(staging, pkg) + if (!npmConfig) { + npmConfig = require('../../config/figgy-config.js') + } let opts = ExtractOpts(npmConfig()).concat({ integrity: pkg.package._integrity, resolved: pkg.package._resolved