Skip to content

chore: bump the plugin header with @ucsantacruz/wordpress-version-updater - #150

Merged
Herm71 merged 3 commits into
mainfrom
Herm71/issue149
Nov 7, 2026
Merged

Herm71 merged 3 commits into
mainfrom
Herm71/issue149

Conversation

@Herm71

@Herm71 Herm71 commented Nov 7, 2026

Copy link
Copy Markdown
Member

Closes #149.

This PR replaces the repo-local wp-plugin-version-updater.js with the shared @ucsantacruz/wordpress-version-updater package (2.0.0). It adds tests for the package against this plugin's own files, and it runs the tests in CI.

Changes

  • package.json
    • Adds the package as a dev dependency.
    • The plugin.php entry in bumpFiles now points at node_modules/@ucsantacruz/wordpress-version-updater/index.js. commit-and-tag-version loads a string updater as a file path, not as a package name.
    • Adds a prerelease script, wordpress-version-updater check plugin.php. It runs before the release writes a file. If the package or the Version: line is missing, the release stops.
  • wp-plugin-version-updater.js is deleted.
  • tests/node/version-updater.test.js is new. You run it with npm run test:release. It uses the built-in node:test runner, so it adds no test dependencies. The tests check that:
    • the version in plugin.php matches package.json and package-lock.json.
    • writeVersion writes multi-digit versions (0.5.10) and -rc.N versions, and changes only the Version: line.
    • a release version written over an -rc.N version leaves no suffix.
    • the check command passes on plugin.php and exits with code 1 on a file with no header.
    • package.json still sends plugin.php through the package.
  • ci.yml: the package job runs npm run test:release after npm ci.
  • CLAUDE.md and .github/copilot-instructions.md describe the package, the prerelease check and the new tests.

Note for reviewers

The package-lock.json diff is large, about 3,500 lines added and 3,600 removed. npm install refreshed the dev dependency tree along with the new package, and the refresh is intentional. npm audit goes from 80 issues (3 critical) to 72 (0 critical). Nothing in this tree ships in the plugin ZIP.

Testing

  • npm run test:release: 9 tests pass.
  • npx commit-and-tag-version --dry-run runs the prerelease check and bumps plugin.php, package.json and package-lock.json from 0.5.9 to 0.5.10.
  • npm ci --dry-run passes, so the lockfile is in sync.
  • composer lint and composer test did not run locally. No PHP file changed. CI runs both.

🤖 Generated with Claude Code

Herm71 and others added 3 commits November 7, 2026 08:00
…ater

Replace the repo-local wp-plugin-version-updater.js with the shared
@ucsantacruz/wordpress-version-updater package (2.0.0). The bumpFiles
entry for plugin.php now points at
node_modules/@ucsantacruz/wordpress-version-updater/index.js, because
commit-and-tag-version loads a string `updater` as a file path, not as a
package name.

Add a `prerelease` script that runs `wordpress-version-updater check
plugin.php`. commit-and-tag-version changes a thrown updater error into a
warning and continues the release, so a missing header could let
package.json move while plugin.php stayed behind. The check runs before
the release writes a file and stops it if the package or the `Version:`
line is missing.

The package-lock.json refresh is intentional. `npm install` updated the
dev dependency tree along with the new package. npm audit goes from 80
issues (3 critical) to 72 (0 critical). Nothing in the tree ships in the
plugin ZIP.

Refs #149

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add tests/node/version-updater.test.js, run with `npm run test:release`
on the built-in node:test runner, so it adds no test dependencies. The
tests check that:

- readVersion() on plugin.php returns the version in package.json and
  package-lock.json.
- writeVersion() writes multi-digit versions and an -rc.N version, and
  changes only the Version line.
- A release version written over an -rc.N version leaves no suffix.
- `wordpress-version-updater check` passes on plugin.php and exits 1 on
  a file with no header.
- package.json still sends plugin.php through the package and runs the
  prerelease check.

The package job in ci.yml runs the tests after `npm ci` on every PR.

Refs #149

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Update CLAUDE.md and .github/copilot-instructions.md for the move from
wp-plugin-version-updater.js to @ucsantacruz/wordpress-version-updater.
Remove the note about keeping the regex shared between readVersion and
writeVersion, because the regex now lives in the package. Describe the
prerelease check and `npm run test:release`, and make clear that the
Node test file covers release tooling, not the JS test suite that the
ROADMAP rules out.

Closes #149

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Herm71
Herm71 marked this pull request as ready for review November 7, 2026 16:02
@Herm71
Herm71 merged commit 4aa73bc into main Nov 7, 2026
3 checks passed
@Herm71
Herm71 deleted the Herm71/issue149 branch November 7, 2026 16:02
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.

Add version bumping package from NPM

1 participant