Skip to content

fix: anchor root-level entries in package.json files - #1971

Merged
mdjastrzebski merged 1 commit into
mainfrom
fix/package-files-anchoring
Dec 1, 2026
Merged

mdjastrzebski merged 1 commit into
mainfrom
fix/package-files-anchoring

Conversation

@mdjastrzebski

Copy link
Copy Markdown
Member

Summary

  • Start the root-level filenames in package.json files with /: matchers.js, matchers.d.ts, pure.js, pure.d.ts and dont-cleanup-after-each.js.
  • Yarn 4 resolves a files entry that contains a / against the package root. It matches an entry without a / by basename, at any depth. So in a checkout with the refs/ submodules, yarn pack adds refs/react-testing-library/{pure.js,pure.d.ts,dont-cleanup-after-each.js,src/pure.js,types/pure.d.ts}. A leftover build/pure.d.ts gets in the same way: when files is set, Yarn does not apply the root .gitignore.
  • npm already reads these entries as root-relative, so npm publish (used by release-it) was not affected, and published versions are clean. This change makes yarn pack and yarn npm publish produce the same file list as npm.
  • dist/ and docs/ stay as they are. Their trailing slash already anchors them to the root, so a nested docs/ (such as website/docs) does not get in.

Test plan

  • Before the fix, yarn pack --dry-run with build/pure.d.ts and build/nested/pure.js present lists both files. In the main checkout, it also lists the five refs/react-testing-library/ files.
  • After the fix, yarn pack --dry-run lists no build/, refs/ or website/ paths. It still lists the root matchers.js, matchers.d.ts, pure.js, pure.d.ts, dont-cleanup-after-each.js, package.json, README.md, LICENSE and CHANGELOG.md.
  • Nested build/dist/x.js and build/docs/x.md were not packed before or after the fix.
  • npm pack --dry-run lists the same root files before and after the fix.
  • Not run: yarn validate. The change only touches the files list, which no build, test or lint step reads. Not checked with a built dist/ in the worktree. dist/ is matched by an unchanged entry.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.60%. Comparing base (3e5564e) to head (51f2133).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1971   +/-   ##
=======================================
  Coverage   98.60%   98.60%           
=======================================
  Files          88       88           
  Lines        1786     1786           
  Branches      492      491    -1     
=======================================
  Hits         1761     1761           
  Misses         24       24           
  Partials        1        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mdjastrzebski
mdjastrzebski merged commit bdbfe2e into main Dec 1, 2026
38 checks passed
@mdjastrzebski
mdjastrzebski deleted the fix/package-files-anchoring branch December 1, 2026 10:10
@mdjastrzebski

Copy link
Copy Markdown
Member Author

Released in v14.1.1 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant