Skip to content

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

Closed
@valtlai

Description

@valtlai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions