| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/usr/bin/env bun
- /**
- * Build script for the reconstructed Workbench CLI.
- *
- * Usage: bun build.ts
- */
- import { $ } from 'bun';
- const version = process.env.VERSION || '0.1.0';
- const buildTime = new Date().toISOString();
- console.log(`Building Workbench CLI v${version}...`);
- const result = await Bun.build({
- entrypoints: ['src/entrypoints/cli.tsx'],
- outdir: 'dist',
- target: 'bun',
- sourcemap: 'linked',
- define: {
- 'MACRO.VERSION': JSON.stringify(version),
- 'MACRO.BUILD_TIME': JSON.stringify(buildTime),
- 'MACRO.FEEDBACK_CHANNEL': JSON.stringify('#workbench-cli'),
- 'MACRO.ISSUES_EXPLAINER': JSON.stringify(
- 'report the issue in this repository issue tracker',
- ),
- 'MACRO.PACKAGE_URL': JSON.stringify('workbench-cli'),
- 'MACRO.NATIVE_PACKAGE_URL': JSON.stringify('workbench-cli-native'),
- 'MACRO.VERSION_CHANGELOG': JSON.stringify(''),
- },
- external: ['react-devtools-core', 'sharp'],
- });
- if (!result.success) {
- console.error('Build failed:');
- for (const log of result.logs) {
- console.error(log);
- }
- process.exit(1);
- }
- console.log(`Build succeeded: dist/cli.js (${(result.outputs[0]!.size / 1024 / 1024).toFixed(1)} MB)`);
|