cc-haha/scripts/quality-gate/persistence-upgrade.ts
程序员阿江(Relakkes) 4d6b1855bf release: prepare v0.3.2
Prepare the desktop release metadata and concise release notes while keeping
tagging and release publishing for a later step. The staged local build-script
updates keep desktop commands on checked-in local toolchain paths and avoid
rewriting preview-agent output when the built content is unchanged.

The persistence-upgrade gate now runs the focused desktop Vitest migration
suite in non-watch mode, matching the broader desktop quality lane and avoiding
pre-push termination during release preparation.

Constraint: Release publishing is intentionally deferred per request
Constraint: Desktop release metadata must keep package, Tauri config, Cargo metadata, and Cargo.lock aligned
Confidence: medium
Scope-risk: moderate
Directive: Do not tag v0.3.2 until release dry-run and final release verification are rerun on the release candidate
Tested: bun run scripts/release.ts 0.3.2 --dry
Tested: cd desktop && bun run lint
Tested: bun run check:persistence-upgrade
Tested: git diff --check
Not-tested: Full bun run verify
2026-06-01 02:30:01 +08:00

48 lines
1.1 KiB
TypeScript

#!/usr/bin/env bun
type Check = {
title: string
command: string[]
cwd?: string
}
const rootDir = process.cwd()
const checks: Check[] = [
{
title: 'Server persistent JSON migrations',
command: ['bun', 'test', 'src/server/__tests__/persistence-upgrade.test.ts'],
},
{
title: 'Desktop localStorage migrations',
command: ['bun', 'run', 'test', '--', '--run', 'src/lib/persistenceMigrations.test.ts'],
cwd: 'desktop',
},
]
async function runCheck(check: Check): Promise<number> {
const cwd = check.cwd ? `${rootDir}/${check.cwd}` : rootDir
console.log(`\n[persistence-upgrade] ${check.title}`)
console.log(`$ ${check.command.join(' ')}`)
const proc = Bun.spawn(check.command, {
cwd,
stdout: 'inherit',
stderr: 'inherit',
})
return proc.exited
}
let failures = 0
for (const check of checks) {
const code = await runCheck(check)
if (code !== 0) {
failures += 1
}
}
if (failures > 0) {
console.error(`\n[persistence-upgrade] failed checks: ${failures}`)
process.exit(1)
}
console.log('\n[persistence-upgrade] all checks passed')