Skip to content

fix: resolve patch-package version mismatch for @wordpress/format-library#356

Merged
dcalhoun merged 3 commits intotrunkfrom
fix/format-library-patch-version
Mar 6, 2026
Merged

fix: resolve patch-package version mismatch for @wordpress/format-library#356
dcalhoun merged 3 commits intotrunkfrom
fix/format-library-patch-version

Conversation

@dcalhoun
Copy link
Copy Markdown
Member

@dcalhoun dcalhoun commented Mar 6, 2026

What?

Regenerates the @wordpress/format-library patch file to match the currently installed version and adds --error-on-warn to prevent future mismatches from going unnoticed.

Why?

Running make npm-dependencies produces the following warning:

Warning: patch-package detected a patch file version mismatch

  Don't worry! This is probably fine. The patch was still applied
  successfully. Here's the deets:

  Patch file created for

    @wordpress/format-library@5.38.0

  applied to

    @wordpress/format-library@5.41.0

  At path

    node_modules/@wordpress/format-library

  This warning is just to give you a heads-up. There is a small chance of
  breakage even though the patch was applied successfully. Make sure the package
  still behaves like you expect (you wrote tests, right?) and then run

    patch-package @wordpress/format-library

  to update the version in the patch file name and make this warning go away.

This was introduced by #349 (and subsequent dependency bumps) which upgraded the package without regenerating the patch file.

How?

  1. Regenerated the patch file for @wordpress/format-library@5.41.0 using npx patch-package @wordpress/format-library --exclude='^$' (the --exclude flag is needed because the patch modifies package.json, which patch-package excludes by default).
  2. Added --error-on-warn to the postinstall script so that patch version mismatches cause a hard failure instead of a silent warning. This will cause CI (and local installs) to fail if a dependabot PR bumps a patched package without regenerating the patch.
  3. Documented the --exclude='^$' caveat in AGENTS.md for future reference.

Testing Instructions

Verify CI checks pass.

dcalhoun added 3 commits March 6, 2026 09:13
The patch file was created for v5.38.0 but the installed version is
now v5.41.0, causing a version mismatch warning during `npm install`.
Regenerate the patch to match the current version.
patch-package excludes package.json from diffs by default. Patches
that modify package.json (e.g., adding exports entries) require the
`--exclude='^$'` flag to be included. Add this caveat to AGENTS.md.
Add `--error-on-warn` to the postinstall patch-package command so
that version mismatches between patch files and installed packages
cause a hard failure instead of a silent warning. This prevents
dependabot PRs from being merged with stale patch files.
@dcalhoun dcalhoun added the [Type] Build Tooling Issues or PRs related to build tooling label Mar 6, 2026
@dcalhoun dcalhoun marked this pull request as ready for review March 6, 2026 14:27
@dcalhoun dcalhoun enabled auto-merge (squash) March 6, 2026 14:27
@dcalhoun dcalhoun requested a review from nbradbury March 6, 2026 14:28
Copy link
Copy Markdown
Contributor

@nbradbury nbradbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI passes :shipit:

@dcalhoun dcalhoun merged commit c89455e into trunk Mar 6, 2026
14 checks passed
@dcalhoun dcalhoun deleted the fix/format-library-patch-version branch March 6, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants