npm-packlist 7.0.0 → 7.0.2

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/lib/index.js +7 -2
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -294,8 +294,13 @@ class PackWalker extends IgnoreWalker {
294
294
 
295
295
  // if we have a files array in our package, we need to pull rules from it
296
296
  if (files) {
297
- for (const file of files) {
297
+ for (let file of files) {
298
298
  // invert the rule because these are things we want to include
299
+ if (file.startsWith('/')) {
300
+ file = file.slice(1)
301
+ } else if (file.startsWith('./')) {
302
+ file = file.slice(2)
303
+ }
299
304
  const inverse = `!${file}`
300
305
  try {
301
306
  // if an entry in the files array is a specific file, then we need to include it as a
@@ -305,7 +310,7 @@ class PackWalker extends IgnoreWalker {
305
310
  // if we have a file and we know that, it's strictly required
306
311
  if (stat.isFile()) {
307
312
  strict.unshift(inverse)
308
- this.requiredFiles.push(file.startsWith('/') ? file.slice(1) : file)
313
+ this.requiredFiles.push(file)
309
314
  } else if (stat.isDirectory()) {
310
315
  // otherwise, it's a default ignore, and since we got here we know it's not a pattern
311
316
  // so we include the directory contents
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "npm-packlist",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
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": "lib/index.js",
9
9
  "dependencies": {
10
- "ignore-walk": "^5.0.1"
10
+ "ignore-walk": "^6.0.0"
11
11
  },
12
12
  "author": "GitHub Inc.",
13
13
  "license": "ISC",
@@ -17,8 +17,8 @@
17
17
  ],
18
18
  "devDependencies": {
19
19
  "@npmcli/arborist": "^6.0.0 || ^6.0.0-pre.0",
20
- "@npmcli/eslint-config": "^3.0.1",
21
- "@npmcli/template-oss": "4.4.2",
20
+ "@npmcli/eslint-config": "^4.0.0",
21
+ "@npmcli/template-oss": "4.7.1",
22
22
  "mutate-fs": "^2.1.1",
23
23
  "tap": "^16.0.1"
24
24
  },
@@ -55,6 +55,6 @@
55
55
  },
56
56
  "templateOSS": {
57
57
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
58
- "version": "4.4.2"
58
+ "version": "4.7.1"
59
59
  }
60
60
  }