npm-packlist 1.4.4 → 1.4.8
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.
- package/index.js +22 -7
- package/package.json +11 -4
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',
|
|
@@ -51,6 +53,9 @@ const defaultRules = [
|
|
|
51
53
|
'core.+([0-9])',
|
|
52
54
|
]
|
|
53
55
|
|
|
56
|
+
// There may be others, but :?|<> are handled by node-tar
|
|
57
|
+
const nameIsBadForWindows = file => /\*/.test(file)
|
|
58
|
+
|
|
54
59
|
// a decorator that applies our custom rules to an ignore walker
|
|
55
60
|
const npmWalker = Class => class Walker extends Class {
|
|
56
61
|
constructor (opt) {
|
|
@@ -170,14 +175,14 @@ const npmWalker = Class => class Walker extends Class {
|
|
|
170
175
|
pkg.browser ? '!' + pkg.browser : '',
|
|
171
176
|
pkg.main ? '!' + pkg.main : '',
|
|
172
177
|
'!package.json',
|
|
178
|
+
'!npm-shrinkwrap.json',
|
|
173
179
|
'!@(readme|copying|license|licence|notice|changes|changelog|history){,.*[^~$]}'
|
|
174
180
|
]
|
|
175
|
-
if (pkg.bin)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
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
|
+
}
|
|
181
186
|
|
|
182
187
|
const data = rules.filter(f => f).join('\n') + '\n'
|
|
183
188
|
super.onReadIgnoreFile(packageNecessaryRules, data, _=>_)
|
|
@@ -190,6 +195,16 @@ const npmWalker = Class => class Walker extends Class {
|
|
|
190
195
|
then()
|
|
191
196
|
}
|
|
192
197
|
|
|
198
|
+
// override parent stat function to completely skip any filenames
|
|
199
|
+
// that will break windows entirely.
|
|
200
|
+
// XXX(isaacs) Next major version should make this an error instead.
|
|
201
|
+
stat (entry, file, dir, then) {
|
|
202
|
+
if (nameIsBadForWindows(entry))
|
|
203
|
+
then()
|
|
204
|
+
else
|
|
205
|
+
super.stat(entry, file, dir, then)
|
|
206
|
+
}
|
|
207
|
+
|
|
193
208
|
// override parent onstat function to nix all symlinks
|
|
194
209
|
onstat (st, entry, file, dir, then) {
|
|
195
210
|
if (st.isSymbolicLink())
|
|
@@ -202,7 +217,7 @@ const npmWalker = Class => class Walker extends Class {
|
|
|
202
217
|
if (file === 'package.json')
|
|
203
218
|
try {
|
|
204
219
|
const ig = path.resolve(this.path, file)
|
|
205
|
-
this.onPackageJson(ig, JSON.parse(data), then)
|
|
220
|
+
this.onPackageJson(ig, normalizePackageBin(JSON.parse(data)), then)
|
|
206
221
|
} catch (er) {
|
|
207
222
|
// ignore package.json files that are not json
|
|
208
223
|
then()
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-packlist",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
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"
|
|
@@ -8,7 +11,8 @@
|
|
|
8
11
|
"main": "index.js",
|
|
9
12
|
"dependencies": {
|
|
10
13
|
"ignore-walk": "^3.0.1",
|
|
11
|
-
"npm-bundled": "^1.0.1"
|
|
14
|
+
"npm-bundled": "^1.0.1",
|
|
15
|
+
"npm-normalize-package-bin": "^1.0.1"
|
|
12
16
|
},
|
|
13
17
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
14
18
|
"license": "ISC",
|
|
@@ -18,7 +22,7 @@
|
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"mkdirp": "^0.5.1",
|
|
20
24
|
"rimraf": "^2.6.1",
|
|
21
|
-
"tap": "^14.
|
|
25
|
+
"tap": "^14.6.9"
|
|
22
26
|
},
|
|
23
27
|
"scripts": {
|
|
24
28
|
"test": "tap",
|
|
@@ -34,5 +38,8 @@
|
|
|
34
38
|
"bugs": {
|
|
35
39
|
"url": "https://github.com/npm/npm-packlist/issues"
|
|
36
40
|
},
|
|
37
|
-
"homepage": "https://www.npmjs.com/package/npm-packlist"
|
|
41
|
+
"homepage": "https://www.npmjs.com/package/npm-packlist",
|
|
42
|
+
"tap": {
|
|
43
|
+
"jobs": 1
|
|
44
|
+
}
|
|
38
45
|
}
|