feat: add bridgeable build cli

This commit is contained in:
2026-04-28 15:32:23 -06:00
commit 6d160ba49f
12 changed files with 1567 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import { existsSync, mkdirSync, rmSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { spawnSync } from 'node:child_process';
export const packDist = ({ distDir, outFile }) => {
const absoluteDist = resolve(distDir);
const absoluteOut = resolve(outFile);
if (!existsSync(absoluteDist)) {
throw new Error(`Cannot pack missing dist directory: ${absoluteDist}`);
}
mkdirSync(dirname(absoluteOut), { recursive: true });
rmSync(absoluteOut, { force: true });
const result = spawnSync('zip', ['-qr', absoluteOut, '.'], {
cwd: absoluteDist,
stdio: 'inherit'
});
if (result.error) {
throw result.error;
}
if (result.status !== 0) {
throw new Error(`zip exited with status ${result.status}`);
}
};