Skip to content

[BUG/QUESTION] since npm 9.x some files[] globs undermatch #152

@43081j

Description

@43081j

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Given this:

{
  "files": [
    "lib/(!test)"
  ]
}

and a tree like this:

- lib
  - main.js
  - foo.js
  - utils
    - foo-util.js
  - test
    - main_test.js
    - foo_test.js
    - utils
      - foo-util_test.js

before the hefty refactor that happened around npm 9 (in npm-packlist), that glob would result in this:

- lib
  - main.js
  - foo.js
  - utils
    - foo-util.js

After the refactor, this is the resulting packed tree:

- lib
  - main.js

meaning the glob was ignored really (since ${main} is enforceably included).

it can be solved by changing the files array to this:

{
  "files": [
    "lib/",
    "!lib/test/"
  ]
}

which im fine with, but it does mean you've introduced a breaking change which i can't see in the changelog (could be me being blind though).

can you clarify if this is a bug or intentional? and close this if it is the latter, with an explanation if you can

Expected Behavior

glob is respected

Steps To Reproduce

N/A

Environment

  • npm: 9.2.0
  • Node: 19.3.0
  • OS: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 1high priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions