Skip to content

chore: adopt the release standard - #101

Open
crcatala-vps wants to merge 3 commits into
mainfrom
chore/release-standard
Open

crcatala-vps wants to merge 3 commits into
mainfrom
chore/release-standard

Conversation

@crcatala-vps

Copy link
Copy Markdown
Collaborator

Summary

Adopts the shared release standard: hand-cut releases from a clean main through
scripts/release.mjs, a changelog gate, a stamped --version line, an update command,
and a from-source install section. No version bump, no release, no publish.

What changed

Canonical files (byte-for-byte copies of the standard's templates)

  • scripts/prep-release.sh (replaces the old ad-hoc version)
  • scripts/check-changelog.sh (new — the release refuses to start without Unreleased entries)
  • scripts/release.mjs (new — preflight, release-it, then publish from the tagged commit)
  • scripts/build-info.mjs (new — stamps dist/build-info.json at the end of build)
  • scripts/test-package.sh (replaces the old smoke test)

Project-specific hook

  • scripts/test-package.local.sh (new) keeps the old smoke test's own checks: both tt and
    ttcli must be installed and must report the exact package.json version (plus --help).

Adapted (non-canonical) files

  • .release-it.json: npm.publish: false so release.mjs publishes after the tag; before:init
    now runs scripts/check-changelog.sh and bun run verify; hooks call bun run; schema bumped to
    release-it 21.
  • package.json: release, release:dry, release:publish and release:prep go through
    release.mjs / the shared prep script; build ends with node scripts/build-info.mjs;
    "files" ships dist/build-info.json. Version unchanged at 0.1.3.
  • RELEASING.md: rewritten for the wrapped flow, bun, and the resume-from-the-failed-step recovery.
  • README.md: ## Install now has registry install, From source (clone, bun install,
    bun run build, npm link, tt --version) and Updating (tt update --check, tt update);
    tt update / tt version added to the command reference.
  • src/cli-meta.ts (new, adapted from the template) + src/index.ts: tt --version / -V prints
    tt X.Y.Z (sha7 YYYY-MM-DD) (-dirty for uncommitted builds; version alone when there is no
    commit stamp). tt update [--check] [--force] updates the way the CLI was installed;
    tt version [--json] reports version, commit, date, dirty state, install method and path.
  • CHANGELOG.md: Unreleased entries for the new update/version commands and the new --version
    format. No release section was added.

Test runner fix (pre-existing bug, found while verifying)

  • bun --raw-test is not a bun flag: it printed bun's help and exited 0, so bun run test — used
    by verify, CI and the release preflight — never ran a test. The script is now
    bun test --isolate (~485 tests run, 443 pass / 42 skipped). --isolate is needed because
    tests/unit/config.config.test.ts mocks the fs module and bun never restores it, so later
    files saw the stub.
  • New tests: tests/unit/cli-meta.test.ts and tests/integration/cli-version.test.ts cover the
    version line format, install detection, update steps, --version/-V, version --json and
    update --check exit codes.

What was kept that differs from the standard, and why

  • Package manager is bun, not npm (bun install, bun run … everywhere; npm only for
    pack/publish/view/whoami, as the Node reference allows). CI installs with
    bun install --frozen-lockfile.
  • cli-meta prefers bun.lock over pnpm-lock.yaml. This repo keeps both lockfiles, but bun is
    the package manager, so a source-checkout update must run bun install + bun run build.
  • prepublishOnly: bun run verify kept. It is an extra publish safeguard the repo already had
    and it still runs before npm publish from release.mjs.
  • tt and ttcli both kept. The standard's --version line uses tt (the name the README uses
    as primary); ttcli prints the same line with its own name, since it is the same binary.
  • release:dry refuses without an npm login, because release.mjs's preflight requires
    npm whoami even for a dry run (canonical behaviour, not modified). RELEASING.md documents the
    direct npx release-it --dry-run --ci --no-npm --no-github preview for that case.
  • Version number untouched (0.1.3); no tags, releases or publishes were created.

Verification

Run on the branch, from a committed (clean) tree, Node 24.22.1 / Bun 1.4.4 / npm 11.19.1:

Command Result
bun install --frozen-lockfile ok, 289 installs, no changes
bun run lint (CI lint) 0 warnings, 0 errors
bun run typecheck (CI typecheck) ok
bun run test (CI test) 485 tests, 443 pass, 42 skip, 0 fail
bun run build (CI test, node-smoke) ok, dist/build-info.json stamped
bun run test:package (CI test) “Local package checks passed (tt and ttcli report 0.1.3)” + “Package smoke test passed.”
bun run verify (repo verify) exit 0
node smoke (node dist/index.js --version, --help, project edit --help) ok (local Node 24 only; CI covers 22.12)
node dist/index.js --version tt 0.1.3 (218e598 2026-10-27) — this commit, clean
node dist/index.js update --check tt is up to date (218e598)., exit 0 (0/1/2 accepted)
bun run release:dry exits 1 with “not logged in to npm” — expected: no npm login on this machine; release.mjs is canonical and untouched
npx release-it --dry-run --ci --no-npm --no-github --git.requireBranch=chore/release-standard plans 0.1.3...0.1.4, commit chore: release v0.1.4, tag v0.1.4, push --follow-tags; hooks reported as skipped; tree clean, no tag created
bash scripts/check-changelog.sh “Changelog has unreleased entries.”
bash scripts/prep-release.sh prints the drafting prompt and commits since v0.1.3
python3 scripts/audit.py . 0 failing, 0 warnings, 28 checks

No real release, tag push, npm publish or GitHub Release was run; the PR is not merged.

crcatala-vps and others added 3 commits October 27, 2026 17:47
`bun --raw-test` is not a bun flag: it printed bun's help and exited 0, so
`bun run test` — used by verify, CI, and the release preflight — never ran a
test. Use `bun test` instead.

`--isolate` keeps each test file in its own global object: the module mock of
`fs` in tests/unit/config.config.test.ts is never restored by bun, so without
it every later file that touches node:fs saw the stub.

Co-authored-by: Christian Catalan <crcatala@gmail.com>
Copy the canonical release scripts byte for byte (prep-release.sh,
check-changelog.sh, release.mjs, build-info.mjs, test-package.sh) and keep this
project's own smoke-test checks in scripts/test-package.local.sh, which the
canonical script sources: both `tt` and `ttcli` must be installed and report the
package.json version exactly.

- .release-it.json: stop releasing through release-it's npm plugin
  (npm.publish: false) so scripts/release.mjs publishes from the released
  commit; run the changelog check before verify; hooks stay on bun.
- package.json: release/release:dry/release:publish/release:prep now go through
  release.mjs and the shared prep script; the build stamps
  dist/build-info.json (scripts/build-info.mjs) and "files" ships it.
- RELEASING.md: rewritten for the wrapped flow, bun, and the npm/git recovery
  steps.

Co-authored-by: Christian Catalan <crcatala@gmail.com>
`tt --version` / `tt -V` now prints `tt X.Y.Z (sha7 YYYY-MM-DD)`, with `-dirty`
when the build came from a tree with uncommitted changes, instead of the bare
version. src/cli-meta.ts reads the stamp written by scripts/build-info.mjs for
builds, and git for code running from src/ in a checkout, so a stale build
never hides newer commits; a build without commit information prints only the
version.

`tt update [--check] [--force]` updates the CLI the way it was installed: a
clone is pulled with `git pull --ff-only` and rebuilt with bun, a global npm
install is reinstalled from the registry, npx is told it already runs the
latest. `--check` reports only: exit 0 up to date, 1 update available, 2 when
it cannot tell. `tt version [--json]` shows the version, full commit, date,
dirty state, install method and path.

`packageManagerFor` prefers bun.lock over the pnpm lockfile this repository
also keeps, so a checkout update installs and builds with bun, like CI does.

Docs: the README Install section gains From source and Updating; the changelog
has the Unreleased entries.

Co-authored-by: Christian Catalan <crcatala@gmail.com>
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.

1 participant