-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle-cli.cjs
More file actions
29 lines (27 loc) · 763 Bytes
/
bundle-cli.cjs
File metadata and controls
29 lines (27 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Bundle src/cli.ts into dist/flash-install.bundle.js using esbuild
const esbuild = require('esbuild');
const path = require('path');
const fs = require('fs');
const entry = path.resolve(__dirname, '../src/cli.ts');
const outfile = path.resolve(__dirname, '../dist/flash-install.bundle.js');
esbuild.build({
entryPoints: [entry],
outfile,
bundle: true,
platform: 'node',
format: 'esm',
target: ['node18'],
banner: {
js: '#!/usr/bin/env node',
},
sourcemap: false,
minify: false,
external: ['react-devtools-core'],
}).then(() => {
// Make the output file executable
fs.chmodSync(outfile, 0o755);
console.log('Bundled CLI to', outfile);
}).catch((err) => {
console.error('esbuild bundling failed:', err);
process.exit(1);
});