Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Commit

Permalink
fix: pack git directories properly
Browse files Browse the repository at this point in the history
- add dirPacker to options
- set dirPacker to null on lifecycle options

PR-URL: #4
Credit: @claudiahdz
Close: #4
Reviewed-by: @isaacs
  • Loading branch information
claudiahdz committed Oct 8, 2019
1 parent 425669a commit 3931a75
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,10 @@ class Installer {
pkg, stage, pkgPath, LifecycleOpts(this.opts).concat({
// TODO: can be removed once npm-lifecycle is updated to modern
// config practices.
config: Object.assign({}, this.opts, { log: null }),
config: Object.assign({}, this.opts, {
log: null,
dirPacker: null
}),
dir: this.prefix
}))
).tap(() => { this.timings.scripts += Date.now() - start })
Expand Down
3 changes: 2 additions & 1 deletion lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let workerFarm
const ENABLE_WORKERS = false

const ExtractOpts = figgyPudding({
log: {}
log: {},
dirPacker: {}
})

module.exports = {
Expand Down
14 changes: 14 additions & 0 deletions test/specs/lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ const extract = requireInject('../../../lib/extract.js', {
}
})

test('extract.child() ensures dirPacker is defined', t => {
const name = 'name'
const child = { version: '0.0.0', integrity: 'integrity', resolved: 'resolved' }
const childPath = './path'

const opts = { log: { level: 'level' }, dirPacker: {} }
const a = extract.child(name, child, childPath, opts)

a.then(b => {
t.ok('dirPacker' in b[2], 'dirPacker is defined')
t.end()
})
})

test('extract.child() only overwrites dirPacker when opts.dirPacker is defined', t => {
const name = 'name'
const child = { version: '0.0.0', integrity: 'integrity', resolved: 'resolved' }
Expand Down

0 comments on commit 3931a75

Please sign in to comment.