-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Bugthing that needs fixingthing that needs fixingRelease 6.xwork is associated with a specific npm 6 releasework is associated with a specific npm 6 release
Description
Current Behavior:
npm pack does not ignore patterns like "dir/" in subdirectories, no matter if it was included in .gitignore or .npmignore.
Expected Behavior:
The npm documentation says:
- ".npmignore files follow the same pattern rules as .gitignore files:"
And the git documentation says:
- "You can end patterns with a forward slash (/) to specify a directory."
- "# ignore all files in any directory named build:
build/"
Steps To Reproduce:
- In a bash environment with awk, grep, diff.
- Execute this bash script in an empty directory (it will create all the necessary files and execute the required commands to reproduce the error).
- Basically it tries to ignore the pattern "src/" (i.e. any directory with that name).
- The output should be the following comparison between git and npm using the same .gitignore file:
npm pack result git add -A result
------------------------ ------------------------
coverage/index.html coverage/index.html
dist/file1.js dist/file1.js
dist/file1.spec.js dist/file1.spec.js
dist/file2.js dist/file2.js
dist/file2.spec.js dist/file2.spec.js
> .gitignore
index.js index.js
LICENSE LICENSE
package.json package.json
README.md README.md
spec/src/test1.spec.js <
spec/src/test2.Spec.js <
test/index.js test/index.js
test/test1.js test/test1.js
test/test2.js test/test2.js
The file .gitignore is ignored by npm as expected, but npm wrongly includes two files inside an internal src directory that git ignores as expected.
Environment:
- OS: Ubuntu 20.04.1 LTS (Linux 5.4.0-48-generic fix: improve quoting for run-script arguments #52-Ubuntu SMP x86_64 GNU/Linux)
- Node: 10.19.0
- npm: 6.14.8
VitorLuizC
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingRelease 6.xwork is associated with a specific npm 6 releasework is associated with a specific npm 6 release