Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] npm pack does not ignore patterns like "dir/" in subdirectories #1873

Closed
pomgui opened this issue Sep 29, 2020 · 1 comment
Closed
Labels
Bug thing that needs fixing Release 6.x work is associated with a specific npm 6 release

Comments

@pomgui
Copy link

pomgui commented Sep 29, 2020

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:

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:

  1. In a bash environment with awk, grep, diff.
  2. Execute this bash script in an empty directory (it will create all the necessary files and execute the required commands to reproduce the error).
  3. Basically it tries to ignore the pattern "src/" (i.e. any directory with that name).
  4. 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:

@pomgui pomgui added Bug thing that needs fixing Needs Triage needs review for next steps Release 6.x work is associated with a specific npm 6 release labels Sep 29, 2020
@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label Feb 13, 2021
@darcyclarke
Copy link
Contributor

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is preproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug thing that needs fixing Release 6.x work is associated with a specific npm 6 release
Projects
None yet
Development

No branches or pull requests

2 participants