Files
Ncurator/scripts/release/r2/finalize.mjs
T
hy 7b057c05f8 refactor: reorganize scripts and update paths for build and release processes
- Removed obsolete test script `test_crawl4ai_fit_markdown.py`.
- Deleted `verify-package-main-obfuscation.mjs` as it is no longer needed.
- Updated paths in `app-update-publish-config.test.ts` to reflect new script locations.
- Refactored `package-content-policy.test.ts` to use new paths for content policy scripts.
- Adjusted `package-main-obfuscation.test.ts` to point to the new obfuscation script locations.
- Modified `package-size-budget.test.ts` to use updated paths for size budget scripts.
- Changed `r2-update-metadata-contract.test.ts` to reference the new metadata script.
- Updated `release-fragment-contract.test.ts` to use the new fragment contract script.
- Refactored `release-storage-layout.test.ts` to point to the new storage layout script.
- Added `runtime-trace.test.ts` to test runtime tracing functionality.
- Updated `node-pty-native-release.test.ts` to reflect new paths for native release scripts.
2026-07-20 17:03:38 +08:00

33 lines
1005 B
JavaScript

import { spawn } from 'node:child_process'
import path from 'node:path'
import process from 'node:process'
const args = process.argv.slice(2)
const tagIndex = args.indexOf('--tag')
const releaseTag = tagIndex >= 0 ? args[tagIndex + 1] || '' : ''
if (!/^v\d+\.\d+\.\d+$/u.test(releaseTag)) {
throw new Error('usage: node scripts/release/r2/finalize.mjs --tag <v1.2.3> [--keep-old]')
}
const run = (script) =>
new Promise((resolve, reject) => {
const childArgs = [
path.join(process.cwd(), 'scripts', 'release', 'r2', script),
'--tag',
releaseTag
]
if (args.includes('--keep-old')) childArgs.push('--keep-old')
const child = spawn(process.execPath, childArgs, {
cwd: process.cwd(),
env: process.env,
stdio: 'inherit'
})
child.once('error', reject)
child.once('exit', (code) =>
code === 0 ? resolve() : reject(new Error(`${script} exited with ${code}`))
)
})
await run('finalize-windows.mjs')
await run('finalize-macos.mjs')