guanghu/scripts/build-release-history-page.ts
Guanghu Domestic Migration 9b41d51231
Some checks are pending
Auto-update PR branches / Update open PR branches (push) Waiting to run
CI / Frontend Static Quality Checks (push) Waiting to run
CI / Frontend Tests & Coverage (push) Waiting to run
CI / Rust Tests & Quality Checks (push) Waiting to run
CI / Linux build verification (push) Waiting to run
Deploy docs / Build VitePress site (push) Waiting to run
Deploy docs / Deploy to GitHub Pages (push) Blocked by required conditions
Release (Alpha) / Compute alpha version (push) Waiting to run
Release (Alpha) / Build release artifacts (push) Blocked by required conditions
Release (Alpha) / GitHub Release (alpha) (push) Blocked by required conditions
Release (Alpha) / Update docs and release pages (push) Blocked by required conditions
chore: import sanitized domestic snapshot for REPO-004
Source snapshot: 514ab1975951d94342ea38e64101d5a0f1c51c77
2026-07-17 15:55:28 +08:00

34 lines
969 B
TypeScript

import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { buildReleaseHistoryPage } from '../src/utils/releaseHistoryPage'
function getArg(flag: string): string {
const index = process.argv.indexOf(flag)
const value = index >= 0 ? process.argv[index + 1] : null
if (!value) {
throw new Error(`Missing required argument: ${flag}`)
}
return value
}
function readReleasePayload(filePath: string): unknown {
try {
return JSON.parse(readFileSync(filePath, 'utf8'))
} catch {
return []
}
}
const releasesJsonPath = resolve(getArg('--releases-json'))
const outputFilePath = resolve(getArg('--output-file'))
const releasesPayload = readReleasePayload(releasesJsonPath)
const html = buildReleaseHistoryPage(releasesPayload)
mkdirSync(dirname(outputFilePath), { recursive: true })
writeFileSync(outputFilePath, html)
console.log(`Release history page written to ${outputFilePath}`)