mirror of
https://github.com/hanzoai/frames.git
synced 2026-08-07 18:08:30 +00:00
## What - Add `bun run release:prepare <version>` as the maintainer-facing stable release entrypoint. - Make the first run draft missing changelog artifacts and intentionally exit before tagging; rerunning after manual review delegates to `set-version`. - Tighten the direct `set-version` guard so stable releases also fail when generated TODO changelog copy is still present. - Update maintainer docs to recommend `release:prepare` while keeping `changelog:draft` as the lower-level regeneration tool. ## Why Stable releases should be hard to run without reviewed GitHub release notes and Mintlify changelog copy. This keeps the existing manual rewrite step, but makes the expected path one command that engineers can rerun after review. ## How - Added `scripts/release-prepare.ts` with parsing, draft/review/set-version action selection, and command forwarding. - Added focused script tests for parser behavior, action selection, command forwarding, and TODO detection. - Extracted shared script CLI parsing helpers so `changelog:draft` and `release:prepare` use the same option handling. - Adjusted `changelog:draft --write` so an existing release file is left unchanged unless `--force` is passed, while still allowing a missing docs entry to be added. ## Test plan - [x] Unit tests added/updated: `bun run test:scripts` - [x] Format check: `bun run format:check` - [x] Lint: `bun run lint` - [x] Typecheck: `bun run --filter '*' typecheck` - [x] Fallow audit: `bunx fallow audit --base origin/main --fail-on-issues` - [x] Manual CLI checks: `bun run release:prepare --help`; `bun run set-version 9.9.9` fails before mutation when changelog artifacts are missing - [x] Documentation updated
25 lines
850 B
TypeScript
25 lines
850 B
TypeScript
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
import { CLI_SEMVER_PATTERN, validateCliVersion } from "./cli-options.ts";
|
|
|
|
function fail(message: string): never {
|
|
throw new Error(message);
|
|
}
|
|
|
|
describe("CLI semver validation", () => {
|
|
it("accepts stable and hyphenated prerelease versions", () => {
|
|
assert.doesNotThrow(() => validateCliVersion("1.2.3", CLI_SEMVER_PATTERN, fail));
|
|
assert.doesNotThrow(() => validateCliVersion("1.2.3-alpha.1", CLI_SEMVER_PATTERN, fail));
|
|
assert.doesNotThrow(() =>
|
|
validateCliVersion("1.2.3-alpha-feature.2", CLI_SEMVER_PATTERN, fail),
|
|
);
|
|
});
|
|
|
|
it("rejects underscores in prerelease versions", () => {
|
|
assert.throws(
|
|
() => validateCliVersion("1.2.3-alpha_1", CLI_SEMVER_PATTERN, fail),
|
|
/Invalid semver: 1\.2\.3-alpha_1/,
|
|
);
|
|
});
|
|
});
|