npm-packlist 1.1.8 → 1.1.12

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 (3) hide show
  1. package/README.md +5 -6
  2. package/index.js +21 -10
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -48,12 +48,11 @@ This uses the following rules:
48
48
  1. .npmignore and .gitignore files (their effect is in the package
49
49
  already, there's no need to include them in the package)
50
50
  2. editor junk like `.*.swp`, `._*` and `.*.orig` files
51
- 3. A `/test/` or `/tests/` folder at the root
52
- 4. `.npmrc` files (these may contain private configs)
53
- 5. The `node_modules/.bin` folder
54
- 6. Waf and gyp cruft like `/build/config.gypi` and `.lock-wscript`
55
- 7. Darwin's `.DS_Store` files because wtf are those even
56
- 8. `npm-debug.log` files at the root of a project
51
+ 3. `.npmrc` files (these may contain private configs)
52
+ 4. The `node_modules/.bin` folder
53
+ 5. Waf and gyp cruft like `/build/config.gypi` and `.lock-wscript`
54
+ 6. Darwin's `.DS_Store` files because wtf are those even
55
+ 7. `npm-debug.log` files at the root of a project
57
56
 
58
57
  You can explicitly re-include any of these with a `files` list in
59
58
  `package.json` or a negated ignore file rule.
package/index.js CHANGED
@@ -20,10 +20,14 @@ const path = require('path')
20
20
  const defaultRules = [
21
21
  '.npmignore',
22
22
  '.gitignore',
23
- '**/.git/',
24
- '**/.svn/',
25
- '**/.hg/',
26
- '**/CVS/',
23
+ '**/.git',
24
+ '**/.svn',
25
+ '**/.hg',
26
+ '**/CVS',
27
+ '**/.git/**',
28
+ '**/.svn/**',
29
+ '**/.hg/**',
30
+ '**/CVS/**',
27
31
  '/.lock-wscript',
28
32
  '/.wafpickle-*',
29
33
  '/build/config.gypi',
@@ -33,8 +37,8 @@ const defaultRules = [
33
37
  '.DS_Store',
34
38
  '._*',
35
39
  '*.orig',
36
- '/test{,s}/',
37
- 'package-lock.json'
40
+ 'package-lock.json',
41
+ 'archived-packages/**',
38
42
  ]
39
43
 
40
44
  // a decorator that applies our custom rules to an ignore walker
@@ -77,7 +81,11 @@ const npmWalker = Class => class Walker extends Class {
77
81
  // get the partial path from the root of the walk
78
82
  const p = this.path.substr(this.root.length + 1)
79
83
  const pkgre = /^node_modules\/(@[^\/]+\/?[^\/]+|[^\/]+)(\/.*)?$/
80
- const pkg = pkgre.test(entry) ? entry.replace(pkgre, '$1') : null
84
+ const isRoot = !this.parent
85
+ const pkg = isRoot && pkgre.test(entry) ?
86
+ entry.replace(pkgre, '$1') : null
87
+ const rootNM = isRoot && entry === 'node_modules'
88
+ const rootPJ = isRoot && entry === 'package.json'
81
89
 
82
90
  return (
83
91
  // if we're in a bundled package, check with the parent.
@@ -87,14 +95,17 @@ const npmWalker = Class => class Walker extends Class {
87
95
  // if package is bundled, all files included
88
96
  // also include @scope dirs for bundled scoped deps
89
97
  // they'll be ignored if no files end up in them.
98
+ // However, this only matters if we're in the root.
99
+ // node_modules folders elsewhere, like lib/node_modules,
100
+ // should be included normally unless ignored.
90
101
  : pkg ? -1 !== this.bundled.indexOf(pkg) ||
91
102
  -1 !== this.bundledScopes.indexOf(pkg)
92
103
 
93
104
  // only walk top node_modules if we want to bundle something
94
- : entry === 'node_modules' && !this.parent ? !!this.bundled.length
105
+ : rootNM ? !!this.bundled.length
95
106
 
96
107
  // always include package.json at the root.
97
- : entry === 'package.json' && !this.parent ? true
108
+ : rootPJ ? true
98
109
 
99
110
  // otherwise, follow ignore-walk's logic
100
111
  : super.filterEntry(entry, partial)
@@ -125,7 +136,7 @@ const npmWalker = Class => class Walker extends Class {
125
136
  const rules = [
126
137
  pkg.browser ? '!' + pkg.browser : '',
127
138
  pkg.main ? '!' + pkg.main : '',
128
- '!@(readme|license|licence|notice|changes|changelog|history){,.*}'
139
+ '!@(readme|copying|license|licence|notice|changes|changelog|history){,.*}'
129
140
  ].filter(f => f).join('\n') + '\n'
130
141
  super.onReadIgnoreFile(packageNecessaryRules, rules, _=>_)
131
142
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "npm-packlist",
3
- "version": "1.1.8",
3
+ "version": "1.1.12",
4
4
  "description": "Get a list of the files to add from a folder into an npm package",
5
5
  "directories": {
6
6
  "test": "test"
7
7
  },
8
8
  "main": "index.js",
9
9
  "dependencies": {
10
- "ignore-walk": "^3.0.0",
10
+ "ignore-walk": "^3.0.1",
11
11
  "npm-bundled": "^1.0.1"
12
12
  },
13
13
  "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
@@ -18,7 +18,7 @@
18
18
  "devDependencies": {
19
19
  "mkdirp": "^0.5.1",
20
20
  "rimraf": "^2.6.1",
21
- "tap": "^10.3.2"
21
+ "tap": "^12.0.1"
22
22
  },
23
23
  "scripts": {
24
24
  "test": "tap test/*.js --100 -J",