Context
pnpm run release:bump <version> (scripts/bump-version.mjs) updates three package.json files in lockstep:
const TARGETS = [
'package.json',
'packages/jssdk/package.json',
'packages/jssdk-nuxt/package.json'
]
It does not touch packages/jssdk-nuxt/src/module.ts:8, which carries a hard-coded version: 'X.Y.Z' literal inside defineNuxtModule({ meta }). That literal feeds Nuxt DevTools, Nuxt's meta.compatibility checks, and any consumer that reads nuxt.modules introspectively.
Result: at every release since v1.0.x the literal has had to be bumped by hand. On main right now the literal is at 1.1.1 while the package.json files are at 1.1.3 — a 2-patch drift.
Proposal
Extend bump-version.mjs to also rewrite the module.ts literal:
- Add the file to
TARGETS as a special-case entry (the existing JSON parsing won't fit).
- Use a surgical regex like
/(\bversion:\s*['"])\d+\.\d+\.\d+(-[\w.-]+)?(['"])/ against the file content, asserting exactly one match (spawnSync.refuse if matches !== 1).
- Verify the literal matches the current package.json version before the bump (same drift check the script already does for JSON targets).
- Print the same
Updated <path>: X.Y.Z → A.B.C line so the CLI output stays uniform.
Acceptance criteria
Side note
It would be cleaner long-term to read the version from package.json at build time (Nuxt module-builder supports this via unjs/unbuild token replacement, similar to how packages/jssdk/build.config.ts replaces __SDK_VERSION__). But that's a refactor; the regex bumper is the minimal fix.
Related
Context
pnpm run release:bump <version>(scripts/bump-version.mjs) updates threepackage.jsonfiles in lockstep:It does not touch packages/jssdk-nuxt/src/module.ts:8, which carries a hard-coded
version: 'X.Y.Z'literal insidedefineNuxtModule({ meta }). That literal feeds Nuxt DevTools, Nuxt'smeta.compatibilitychecks, and any consumer that readsnuxt.modulesintrospectively.Result: at every release since v1.0.x the literal has had to be bumped by hand. On
mainright now the literal is at1.1.1while the package.json files are at1.1.3— a 2-patch drift.Proposal
Extend
bump-version.mjsto also rewrite themodule.tsliteral:TARGETSas a special-case entry (the existing JSON parsing won't fit)./(\bversion:\s*['"])\d+\.\d+\.\d+(-[\w.-]+)?(['"])/against the file content, asserting exactly one match (spawnSync.refuse if matches !== 1).Updated <path>: X.Y.Z → A.B.Cline so the CLI output stays uniform.Acceptance criteria
pnpm run release:bump <version>updatespackages/jssdk-nuxt/src/module.tsalong with the threepackage.jsonfiles.version:literal match inmodule.ts(safety net against future refactors).module.tsis now in scope (optional, retrospective).Side note
It would be cleaner long-term to read the version from
package.jsonat build time (Nuxt module-builder supports this viaunjs/unbuildtoken replacement, similar to howpackages/jssdk/build.config.tsreplaces__SDK_VERSION__). But that's a refactor; the regex bumper is the minimal fix.Related
module.tsbump