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

[BUG] Negation of files is ignored in npm v7 #2009

Closed
valtlai opened this issue Oct 21, 2020 · 2 comments
Closed

[BUG] Negation of files is ignored in npm v7 #2009

valtlai opened this issue Oct 21, 2020 · 2 comments
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@valtlai
Copy link

valtlai commented Oct 21, 2020

Current Behavior:

Negated patterns in the files array of package.json have no effect.

Expected Behavior:

Negated patterns should cause the matching files to be excluded from the published package.

Steps To Reproduce:

  1. Add the following files array in package.json:

    "files": [
       "**/*.js",
       "!foo.js"
    ],
  2. Create a foo.js file.

  3. Run npm publish --dry-run.

  4. See how the output incorrectly contains foo.js.

Environment:

  • OS: macOS 10.15.7
  • Node: 15.0.1
  • npm: 7.0.3
@valtlai valtlai added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Oct 21, 2020
@isaacs
Copy link
Contributor

isaacs commented Oct 21, 2020

Ahhh, nice one.

The issue is that we're globbing each of these entries in parallel, but not maintaining the order when they come back. Bug in npm-packlist that I missed because the sync version used by the npm-packlist bin script doesn't suffer from this problem.

Good catch, will have a fix soon.

@isaacs
Copy link
Contributor

isaacs commented Oct 21, 2020

Will be in the next npm v7 release.

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

No branches or pull requests

2 participants