-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbuild.mjs
More file actions
58 lines (54 loc) · 1.63 KB
/
build.mjs
File metadata and controls
58 lines (54 loc) · 1.63 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { build } from 'esbuild';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
await build({
entryPoints: [resolve(__dirname, 'apps/cli/src/index.ts')],
bundle: true,
platform: 'node',
target: 'node20',
format: 'esm',
outfile: resolve(__dirname, 'dist/index.mjs'),
external: [
'playwright',
],
jsx: 'automatic',
plugins: [{
name: 'stub-react-devtools',
setup(build) {
build.onResolve({ filter: /^react-devtools-core$/ }, () => ({
namespace: 'stub',
path: 'react-devtools-core',
}));
build.onLoad({ filter: /.*/, namespace: 'stub' }, () => ({
contents: 'export default {};',
loader: 'js',
}));
},
}],
banner: {
js: [
'#!/usr/bin/env node',
'import { createRequire as __createRequire } from "module";',
'import { fileURLToPath as __fileURLToPath } from "url";',
'import { dirname as __pathDirname } from "path";',
'const require = __createRequire(import.meta.url);',
'const __filename = __fileURLToPath(import.meta.url);',
'const __dirname = __pathDirname(__filename);',
].join('\n'),
},
minify: false,
sourcemap: true,
loader: { '.tsx': 'tsx', '.jsx': 'jsx' },
});
await build({
entryPoints: [resolve(__dirname, 'packages/core/src/sub-agents/code-quality-subagent-worker.ts')],
bundle: true,
platform: 'node',
target: 'node20',
format: 'cjs',
outfile: resolve(__dirname, 'dist/code-quality-subagent-worker.cjs'),
sourcemap: true,
});
console.log('✅ CLI bundled successfully');