Skip to content

release:bump: also update the hard-coded version literal in packages/jssdk-nuxt/src/module.ts #119

@IgorShevchik

Description

@IgorShevchik

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:

  1. Add the file to TARGETS as a special-case entry (the existing JSON parsing won't fit).
  2. Use a surgical regex like /(\bversion:\s*['"])\d+\.\d+\.\d+(-[\w.-]+)?(['"])/ against the file content, asserting exactly one match (spawnSync.refuse if matches !== 1).
  3. Verify the literal matches the current package.json version before the bump (same drift check the script already does for JSON targets).
  4. Print the same Updated <path>: X.Y.Z → A.B.C line so the CLI output stays uniform.

Acceptance criteria

  • pnpm run release:bump <version> updates packages/jssdk-nuxt/src/module.ts along with the three package.json files.
  • The script refuses on drift (literal != package.json before bump).
  • The script refuses if there's not exactly one version: literal match in module.ts (safety net against future refactors).
  • Update the existing CHANGELOG-1.1.1 entry to note that module.ts is now in scope (optional, retrospective).
  • Drop the manual step from any release runbook.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions