Files
wehub-resource-sync adc62957a7
CI / Multi-repo Path Gate (AST-grep) (windows-latest) (push) Has been cancelled
CI / Version Consistency Check (push) Has been cancelled
CI / npm pack + install test (push) Has been cancelled
CI / Lint & Type Check (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Test (Windows path suite) (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / No Committed Build Artifacts (push) Has been cancelled
CI / Multi-repo Path Gate (AST-grep) (ubuntu-latest) (push) Has been cancelled
Upgrade Test / omc update + session-start hook (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:36:54 +08:00

37 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
import * as esbuild from 'esbuild';
import { mkdir } from 'fs/promises';
const outfile = 'bridge/runtime-cli.cjs';
await mkdir('bridge', { recursive: true });
const watchMode = process.argv.includes('--watch');
const buildConfig = {
entryPoints: ['src/team/runtime-cli.ts'],
bundle: true,
platform: 'node',
target: 'node18',
format: 'cjs',
outfile,
// Note: platform:'node' auto-externalizes all Node built-in subpaths (fs/promises, etc.)
external: [
'fs', 'fs/promises', 'path', 'os', 'util', 'stream', 'events',
'buffer', 'crypto', 'http', 'https', 'url',
'child_process', 'assert', 'module', 'net', 'tls',
'dns', 'readline', 'tty', 'worker_threads',
'@ast-grep/napi', 'better-sqlite3',
// jsonc-parser has dynamic requires that don't bundle well; we use a custom parser
'jsonc-parser',
],
};
if (watchMode) {
const ctx = await esbuild.context(buildConfig);
await ctx.watch();
console.error(`Watching ${outfile}...`);
} else {
await esbuild.build(buildConfig);
console.error(`Built ${outfile}`);
}