npm-packlist 1.4.0 → 1.4.4
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 +34 -9
- package/package.json +5 -4
package/index.js
CHANGED
|
@@ -35,7 +35,9 @@ const defaultRules = [
|
|
|
35
35
|
'**/.npmrc',
|
|
36
36
|
'.*.swp',
|
|
37
37
|
'.DS_Store',
|
|
38
|
+
'**/.DS_Store/**',
|
|
38
39
|
'._*',
|
|
40
|
+
'**/._*/**',
|
|
39
41
|
'*.orig',
|
|
40
42
|
'/package-lock.json',
|
|
41
43
|
'/yarn.lock',
|
|
@@ -89,6 +91,16 @@ const npmWalker = Class => class Walker extends Class {
|
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
onReaddir (entries) {
|
|
95
|
+
if (!this.parent) {
|
|
96
|
+
entries = entries.filter(e =>
|
|
97
|
+
e !== '.git' &&
|
|
98
|
+
!(e === 'node_modules' && this.bundled.length === 0)
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
return super.onReaddir(entries)
|
|
102
|
+
}
|
|
103
|
+
|
|
92
104
|
filterEntry (entry, partial) {
|
|
93
105
|
// get the partial path from the root of the walk
|
|
94
106
|
const p = this.path.substr(this.root.length + 1)
|
|
@@ -146,6 +158,14 @@ const npmWalker = Class => class Walker extends Class {
|
|
|
146
158
|
|
|
147
159
|
// if there's a bin, browser or main, make sure we don't ignore it
|
|
148
160
|
// also, don't ignore the package.json itself!
|
|
161
|
+
//
|
|
162
|
+
// Weird side-effect of this: a readme (etc) file will be included
|
|
163
|
+
// if it exists anywhere within a folder with a package.json file.
|
|
164
|
+
// The original intent was only to include these files in the root,
|
|
165
|
+
// but now users in the wild are dependent on that behavior for
|
|
166
|
+
// localized documentation and other use cases. Adding a `/` to
|
|
167
|
+
// these rules, while tempting and arguably more "correct", is a
|
|
168
|
+
// breaking change.
|
|
149
169
|
const rules = [
|
|
150
170
|
pkg.browser ? '!' + pkg.browser : '',
|
|
151
171
|
pkg.main ? '!' + pkg.main : '',
|
|
@@ -233,15 +253,20 @@ const walkSync = options => {
|
|
|
233
253
|
return walker.result
|
|
234
254
|
}
|
|
235
255
|
|
|
236
|
-
//
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
256
|
+
// optimize for compressibility
|
|
257
|
+
// extname, then basename, then locale alphabetically
|
|
258
|
+
// https://twitter.com/isntitvacant/status/1131094910923231232
|
|
259
|
+
const sort = (a, b) => {
|
|
260
|
+
const exta = path.extname(a).toLowerCase()
|
|
261
|
+
const extb = path.extname(b).toLowerCase()
|
|
262
|
+
const basea = path.basename(a).toLowerCase()
|
|
263
|
+
const baseb = path.basename(b).toLowerCase()
|
|
264
|
+
|
|
265
|
+
return exta.localeCompare(extb) ||
|
|
266
|
+
basea.localeCompare(baseb) ||
|
|
267
|
+
a.localeCompare(b)
|
|
268
|
+
}
|
|
269
|
+
|
|
245
270
|
|
|
246
271
|
module.exports = walk
|
|
247
272
|
walk.sync = walkSync
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-packlist",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
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"
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"mkdirp": "^0.5.1",
|
|
20
20
|
"rimraf": "^2.6.1",
|
|
21
|
-
"tap": "^
|
|
21
|
+
"tap": "^14.2.1"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"test": "tap
|
|
24
|
+
"test": "tap",
|
|
25
|
+
"snap": "tap",
|
|
25
26
|
"preversion": "npm test",
|
|
26
27
|
"postversion": "npm publish",
|
|
27
|
-
"postpublish": "git push origin --
|
|
28
|
+
"postpublish": "git push origin --follow-tags"
|
|
28
29
|
},
|
|
29
30
|
"repository": {
|
|
30
31
|
"type": "git",
|