Single-source the version string #5

Open
opened 2026-08-09 03:43:56 +02:00 by clawbot · 0 comments
Collaborator

Problem

The version is hardcoded in three independent places:

  • package.json:3"version": "0.0.0"
  • src/index.ts:1export const VERSION = "0.0.0";
  • bin/quak.ts:58.version("0.0.0")

Nothing derives one from another, and test/smoke.test.ts only asserts that VERSION is a
non-empty string. A partial bump therefore passes make check and ships a CLI that reports a
different version from the package it came from. This has to be fixed before the v1.0.0 bump,
not during it.

Definition of done

  1. There is exactly one place the version number is written by a human. package.json is the
    natural home for it — resolveJsonModule is already enabled in tsconfig.json.
  2. VERSION exported from src/index.ts and the string reported by quak --version both
    derive from that single source at build time or run time.
  3. A test asserts that VERSION, the CLI's reported version, and package.json's version
    field are all equal. This test must fail if any one of them is changed alone.
  4. Importing package.json does not break the published package layout — if the build emits
    to dist/, the relative path to package.json must resolve both from source (vitest) and
    from the built output. Verify both.
  5. make check green; make build green.
  6. TODO.md updated in the same commit.

Notes

Do not bump the version to 1.0.0 here. That happens in the tagging issue, once every other
1.0.0 blocker is closed.

Depends on

The build fix issue, since the resolution strategy depends on the final dist/ layout.

## Problem The version is hardcoded in three independent places: - `package.json:3` — `"version": "0.0.0"` - `src/index.ts:1` — `export const VERSION = "0.0.0";` - `bin/quak.ts:58` — `.version("0.0.0")` Nothing derives one from another, and `test/smoke.test.ts` only asserts that `VERSION` is a non-empty string. A partial bump therefore passes `make check` and ships a CLI that reports a different version from the package it came from. This has to be fixed before the v1.0.0 bump, not during it. ## Definition of done 1. There is exactly one place the version number is written by a human. `package.json` is the natural home for it — `resolveJsonModule` is already enabled in `tsconfig.json`. 2. `VERSION` exported from `src/index.ts` and the string reported by `quak --version` both derive from that single source at build time or run time. 3. A test asserts that `VERSION`, the CLI's reported version, and `package.json`'s `version` field are all equal. This test must fail if any one of them is changed alone. 4. Importing `package.json` does not break the published package layout — if the build emits to `dist/`, the relative path to `package.json` must resolve both from source (vitest) and from the built output. Verify both. 5. `make check` green; `make build` green. 6. `TODO.md` updated in the same commit. ## Notes Do not bump the version to 1.0.0 here. That happens in the tagging issue, once every other 1.0.0 blocker is closed. ## Depends on The build fix issue, since the resolution strategy depends on the final `dist/` layout.
clawbot added this to the 1.0.0 milestone 2026-08-09 03:43:56 +02:00
clawbot self-assigned this 2026-08-09 03:43:56 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/quak#5