Skip to content

Commit d5dfe57

Browse files
addaleaxMichael Perrotte
authored andcommitted
fix: resolve circular dependency in pack.js
`lib/pack.js` and `lib/config/figgy-config.js` load each other, making `figgy-config.js` grab the original `module.exports` value and not the intended one. In particular, this always sets the `dirPacker` value to `undefined` in the config generation step. Fix this by setting `module.exports` early. Refs: nodejs/node#29935 PR-URL: #266 Credit: @addaleax Close: #266 Reviewed-by: @mikemimik
1 parent b6588a8 commit d5dfe57

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/pack.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// Packs the specified package into a .tgz file, which can then
55
// be installed.
66

7+
// Set this early to avoid issues with circular dependencies.
8+
module.exports = pack
9+
710
const BB = require('bluebird')
811

912
const byteSize = require('byte-size')
@@ -37,7 +40,6 @@ pack.usage = 'npm pack [[<@scope>/]<pkg>...] [--dry-run]'
3740
// if it can be installed, it can be packed.
3841
pack.completion = install.completion
3942

40-
module.exports = pack
4143
function pack (args, silent, cb) {
4244
const cwd = process.cwd()
4345
if (typeof cb !== 'function') {

0 commit comments

Comments
 (0)