Skip to content

Commit

Permalink
install: fix circular dependency with config stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Nov 27, 2018
1 parent 2597958 commit fcdbeae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/fetch-package-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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')
Expand Down
5 changes: 4 additions & 1 deletion lib/install/action/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fcdbeae

Please sign in to comment.