Skip to content

Commit 7ce66b0

Browse files
authored
* correctly ignore .gitignore when a .npmignore is present
1 parent c7d5a69 commit 7ce66b0

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

node_modules/npm-packlist/lib/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ const glob = require('glob')
3434
const globify = pattern => pattern.split('\\').join('/')
3535

3636
const readOutOfTreeIgnoreFiles = (root, rel, result = '') => {
37-
for (const file of ['.gitignore', '.npmignore']) {
37+
for (const file of ['.npmignore', '.gitignore']) {
3838
try {
3939
const ignoreContent = fs.readFileSync(path.join(root, file), { encoding: 'utf8' })
4040
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
4144
} catch (err) {
4245
// we ignore ENOENT errors completely because we don't care if the file doesn't exist
4346
// but we throw everything else because failing to read a file that does exist is

node_modules/npm-packlist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "npm-packlist",
3-
"version": "5.1.0",
3+
"version": "5.1.1",
44
"description": "Get a list of the files to add from a folder into an npm package",
55
"directories": {
66
"test": "test"

package-lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5141,9 +5141,9 @@
51415141
}
51425142
},
51435143
"node_modules/npm-packlist": {
5144-
"version": "5.1.0",
5145-
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-5.1.0.tgz",
5146-
"integrity": "sha512-a04sqF6FbkyOAFA19AA0e94gS7Et5T2/IMj3VOT9nOF2RaRdVPQ1Q17Fb/HaDRFs+gbC7HOmhVZ29adpWgmDZg==",
5144+
"version": "5.1.1",
5145+
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-5.1.1.tgz",
5146+
"integrity": "sha512-UfpSvQ5YKwctmodvPPkK6Fwk603aoVsf8AEbmVKAEECrfvL8SSe1A2YIwrJ6xmTHAITKPwwZsWo7WwEbNk0kxw==",
51475147
"inBundle": true,
51485148
"dependencies": {
51495149
"glob": "^8.0.1",

0 commit comments

Comments
 (0)