npm-packlist 1.4.6 → 1.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +8 -7
  2. package/package.json +4 -1
package/index.js CHANGED
@@ -17,6 +17,8 @@ const rootBuiltinRules = Symbol('root-builtin-rules')
17
17
  const packageNecessaryRules = Symbol('package-necessary-rules')
18
18
  const path = require('path')
19
19
 
20
+ const normalizePackageBin = require('npm-normalize-package-bin')
21
+
20
22
  const defaultRules = [
21
23
  '.npmignore',
22
24
  '.gitignore',
@@ -176,12 +178,11 @@ const npmWalker = Class => class Walker extends Class {
176
178
  '!npm-shrinkwrap.json',
177
179
  '!@(readme|copying|license|licence|notice|changes|changelog|history){,.*[^~$]}'
178
180
  ]
179
- if (pkg.bin)
180
- if (typeof pkg.bin === "object")
181
- for (const key in pkg.bin)
182
- rules.push('!' + pkg.bin[key])
183
- else
184
- rules.push('!' + pkg.bin)
181
+ if (pkg.bin) {
182
+ // always an object, because normalized already
183
+ for (const key in pkg.bin)
184
+ rules.push('!' + pkg.bin[key])
185
+ }
185
186
 
186
187
  const data = rules.filter(f => f).join('\n') + '\n'
187
188
  super.onReadIgnoreFile(packageNecessaryRules, data, _=>_)
@@ -216,7 +217,7 @@ const npmWalker = Class => class Walker extends Class {
216
217
  if (file === 'package.json')
217
218
  try {
218
219
  const ig = path.resolve(this.path, file)
219
- this.onPackageJson(ig, JSON.parse(data), then)
220
+ this.onPackageJson(ig, normalizePackageBin(JSON.parse(data)), then)
220
221
  } catch (er) {
221
222
  // ignore package.json files that are not json
222
223
  then()
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "npm-packlist",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
+ "publishConfig": {
5
+ "tag": "legacy-v1"
6
+ },
4
7
  "description": "Get a list of the files to add from a folder into an npm package",
5
8
  "directories": {
6
9
  "test": "test"