-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] npm pack
doesn't match directory prefiex (dist-*
doesn't match dist-cjs/index.js
)
#7514
Comments
It seems like npm 10 will only treat exactly |
Okay, there's a closed npm/cli issue saying it's fixed #6164, and a npm-packlist issue tracking other packlist changes npm/npm-packlist#152 The fix they reference npm/npm-packlist#147 suggests that packlist should treat |
interestingly |
Yes it's not very well documented, but the way "globstar" is treated got aligned more with standard glob implementations quite some time ago. Not sure what the long term solution will be here, obviously trying to "patch" back the old behavior has been buggy. Your best bet is to fix your globs. |
Added a note to our v11 roadmap to unwind all of these hacks. |
I'm in the position of upgrading the company wide npm version, this is one of the few changes that's causing wide spread differences. It's mainly a matter of documenting the change and explaining how to write equivalent npm 10 patterns. I thin npm 8's |
What does 'unwind all of these hacks' mean? Make it more like npm 8, or make it ' aligned more with standard glob implementations'? IMO npm 8's behavior is not unaligned with standard globs. An analogy, echo shows that dist-* only matches direct children
But when you give those arguments to
Here's another example comparing npm 8 and 10, this time without using
|
It means no longer work around the default |
For what it's worth
|
That is my point,
I think npm 8's pattern matching was good. Requiring explicit recursive patterns would be okay.
|
Yes those last two would be what npm 11 does. |
Will those changes apply to .gitignore and .npmignore? So
|
|
So will there be different pattern rules for .npmignore and I much prefer npm 8's and .gitignore's "if a pattern matches a directory, it's files are matched" behavior to the proposed "a |
These questions show just how wanting we are for a proper spec here. I don't have answers today. The way it works now is not working. That's the only answer I have today. |
If you look through the history of especially |
I'm happy to help out with spec/doc/test writing or discussion. Not sure if this falls under the same umbrella, but I found that symlinks are treated differently between 8 and 10. LMK if I should create a different issue.
Neither 8 or 10 will recursively include files from a symlink that matches the pattern.
npm 8 will match files inside a link, as long as the pattern reaches past the link, but npm 10 won't.
npm 8 will also work with patterns, I think this is the same behavior as before.
npm 10 won't match a file under a symlink even when the exact path is given. The behavior is the same with an internal link, like |
A co worker found an odd behavior with directories named cvs. In this case I can't explain how either npm 8 or 10 is behaving. I understand the CVS is ignored by default, but it's not on the list of files that can't be included (docs)
npm-debug.log is also inconsistent, and differently than cvs.
|
It's on the default ignore list, but it's not on the "can't include" list. Why doesn't
|
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
With npm 10
files: ["dist-*"]
does not includedist-es
ordist-es/index.js
. This is changed from npm 8, not clearly documented, and inconsistent with other patterns.Expected Behavior
I expect the same behavior as npm 8. I don't see anything in the change logs that would explain this difference.
https://docs.npmjs.com/cli/v9/using-npm/changelog#%EF%B8%8F-breaking-changes-2
This bug occurs when there's only a files array, there's no .gitignore or .npmignore to ignore (or respect in npm 8)
Steps To Reproduce
Setup a test project
This test script will print the differences between files included by npm 8 and 10
Results
Environment
The text was updated successfully, but these errors were encountered: