npm-packlist 5.1.0 → 5.1.1

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 +4 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -34,10 +34,13 @@ const glob = require('glob')
34
34
  const globify = pattern => pattern.split('\\').join('/')
35
35
 
36
36
  const readOutOfTreeIgnoreFiles = (root, rel, result = '') => {
37
- for (const file of ['.gitignore', '.npmignore']) {
37
+ for (const file of ['.npmignore', '.gitignore']) {
38
38
  try {
39
39
  const ignoreContent = fs.readFileSync(path.join(root, file), { encoding: 'utf8' })
40
40
  result += ignoreContent + '\n'
41
+ // break the loop immediately after concatting, this allows us to prioritize the
42
+ // .npmignore and discard the .gitignore if one exists
43
+ break
41
44
  } catch (err) {
42
45
  // we ignore ENOENT errors completely because we don't care if the file doesn't exist
43
46
  // but we throw everything else because failing to read a file that does exist is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-packlist",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
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"