Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Incorrect file list when .gitignore and .npmignore differ #629

Closed
groenroos opened this issue Oct 30, 2021 · 1 comment · Fixed by #682
Closed

Incorrect file list when .gitignore and .npmignore differ #629

groenroos opened this issue Oct 30, 2021 · 1 comment · Fixed by #682

Comments

@groenroos
Copy link

"The following new files will be published the first time" list of files does not take into account .npmignore's precedence over .gitignore when a file is excluded in the latter but not the former.

Description

I want a dist/ folder to be included in the package, but excluded from git.

So I have a .gitignore file that ignores dist; an .npmignore that doesn't; and a "files" parameter that explicitly wants to include it.

.gitignore
node_modules/
npm-debug.log
env
.DS_Store
dist
.npmignore
node_modules/
npm-debug.log
env
.DS_Store
package.json
{
    ...
    "files": [
        "dist",
        "index.js"
    ]
}

However, the dist folder and all its contents are excluded from the "following new files will be published the first time" list in the UI. Seems like neither removing .npmignore nor "files" changes this - only removing dist from .gitignore (which is undesirable) displays the correct list of files.

Based on the above setup, npm pack creates a tar that does include the dist folder, so it appears the file list in the UI is incorrect (or I'm missing something obvious)

Steps to reproduce

  1. Create a dist/ folder with some contents
  2. Create a .gitignore that ignores the dist folder
  3. Create a .npmignore that does not ignore the dist folder
  4. Add "dist" into the "files" attrib in package.json
  5. Run npm pack to generate a tar, which should contain the dist folder
  6. Run np - the new file list will not contain dist

Expected behavior

The UI displaying the list of files should include the contents of the dist folder, to match the tar generated by npm pack under these circumstances.

Environment

np - 7.5.0
Node.js - 14.18.1
npm - 6.4.15
Git - 2.31.1
OS - macOS 11.6

@rootwork
Copy link

Probably related to #615 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants