Repository navigation
fix: keep nested .clang-format files out of the package with npm 12 - #2976
Merged
Tommy Nguyen (tido64) merged 1 commit intoOct 19, 2026
Conversation
npm 12 ships npm-packlist 11, which anchors a slashless negation in `files` to the package root, so `!.clang-format` no longer excludes `windows/.clang-format`, and npm 12 packs it. `!**/.clang-format` excludes it at every depth with npm 11 and npm 12 alike. npm 12 also keys `npm pack --json` by package name instead of by index, so the pack test now takes its one tarball with `Object.values`.
YevheniiKotyrlo
marked this pull request as ready for review
October 18, 2026 22:24
YevheniiKotyrlo
requested review from
Jason Morse (JasonVMo) and
Tommy Nguyen (tido64)
as code owners
October 18, 2026 22:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
npm 12 ships npm-packlist 11, which reads
filesas globs anchored to the package root, so a slashless negation such as!.clang-formatnow matches only at the root (npm-packlist 11.0.0). Packed with npm 12, the package therefore includeswindows/.clang-format.!**/.clang-formatexcludes it at every depth with npm 11 and npm 12 alike.npm 12 also keys
npm pack --jsonby package name instead of by index, sonpm pack › includes all filesfailed withTypeError: Cannot read properties of undefined (reading 'files')before comparing anything. The test now takes its one tarball withObject.values, which reads both shapes.Platforms affected
Test plan
node --no-warnings --test test/pack.test.mtsinpackages/app, on Windows with Node 26.5.0:trunkTypeErrorwindows/.clang-formatis packedyarn lint:js,yarn generate:codeandyarn generate:schemaleave nothing to change.yarn test:jspasses apart from thetest-app-util.gradlecases, which fail identically ontrunkon my machine becausecmdthere doesn't rungradlew.batfrom the working directory.