mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
Clean up cross-package build coupling
This commit is contained in:
@@ -16,6 +16,7 @@ import { join } from 'node:path';
|
||||
const scriptDir = import.meta.dir;
|
||||
const projectRoot = join(scriptDir, '..');
|
||||
const repoRoot = join(projectRoot, '..');
|
||||
const buildInfoPath = join(repoRoot, 'shared', 'src', 'buildInfo.ts');
|
||||
|
||||
// 解析参数
|
||||
const args = process.argv.slice(2);
|
||||
@@ -41,6 +42,22 @@ function run(cmd: string, cwd = projectRoot): void {
|
||||
}
|
||||
}
|
||||
|
||||
function updateBuildInfoVersion(nextVersion: string): void {
|
||||
const content = readFileSync(buildInfoPath, 'utf-8');
|
||||
const updated = content.replace(
|
||||
/export const APP_VERSION = ['"][^'"]+['"]/,
|
||||
`export const APP_VERSION = '${nextVersion}'`
|
||||
);
|
||||
|
||||
if (updated === content) {
|
||||
throw new Error(`Could not update APP_VERSION in ${buildInfoPath}`);
|
||||
}
|
||||
|
||||
if (!dryRun) {
|
||||
writeFileSync(buildInfoPath, updated);
|
||||
}
|
||||
}
|
||||
|
||||
async function runWithTimeoutRetry(cmd: string, cwd = projectRoot): Promise<void> {
|
||||
const timeoutCmd = `timeout 60s ${cmd}`;
|
||||
while (true) {
|
||||
@@ -93,6 +110,7 @@ async function main(): Promise<void> {
|
||||
if (!dryRun) {
|
||||
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
||||
}
|
||||
updateBuildInfoVersion(version);
|
||||
console.log(` ${oldVersion} → ${version}`);
|
||||
|
||||
// Step 2: Build all platform binaries (with embedded web assets)
|
||||
|
||||
Reference in New Issue
Block a user