-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathesbuild.config.js
More file actions
77 lines (69 loc) · 2.15 KB
/
esbuild.config.js
File metadata and controls
77 lines (69 loc) · 2.15 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { build, context } from 'esbuild';
import { existsSync } from 'fs';
import { mkdir } from 'fs/promises';
const distDir = 'dist';
// Ensure dist directory exists
if (!existsSync(distDir)) {
await mkdir(distDir, { recursive: true });
}
const shared = {
bundle: true,
format: 'cjs',
platform: 'node',
target: 'node22',
sourcemap: true,
external: ['vscode'],
write: true,
metafile: false,
splitting: false,
};
// Main extension bundle
const extensionConfig = {
...shared,
entryPoints: ['src/extension.ts'],
outfile: 'dist/extension.cjs',
};
// Integration test suite — each file is a separate output so the Mocha
// runner can discover them via glob at runtime.
const testSuiteConfig = {
...shared,
entryPoints: [
'test/suite/index.ts',
'test/suite/bridge.integration.test.ts',
'test/suite/copydb-e2e.integration.test.ts',
'test/suite/extension.integration.test.ts',
'test/suite/file-watcher-stability.integration.test.ts',
'test/suite/mcp-completion-e2e.integration.test.ts',
'test/suite/mcp-prompt-e2e.integration.test.ts',
'test/suite/mcp-resource-e2e.integration.test.ts',
'test/suite/mcp-server.integration.test.ts',
'test/suite/mcp-tool-e2e.integration.test.ts',
'test/suite/workspace-folder-change.integration.test.ts',
'test/suite/workspace-scenario.integration.test.ts',
],
outdir: 'dist/test/suite',
outfile: undefined, // outdir and outfile are mutually exclusive
outExtension: { '.js': '.cjs' },
external: ['vscode'],
logOverride: {
'require-resolve-not-external': 'silent',
},
};
const isWatch = process.argv.includes('--watch');
if (isWatch) {
const ctx = await context(extensionConfig);
await ctx.watch();
console.log('👀 Watching for changes...');
} else {
try {
await build(extensionConfig);
console.log('✅ Extension build completed successfully');
console.log(`📦 Generated: dist/extension.cjs`);
await build(testSuiteConfig);
console.log('✅ Test suite build completed successfully');
console.log(`📦 Generated: dist/test/suite/*.cjs`);
} catch (error) {
console.error('❌ Build failed:', error);
process.exit(1);
}
}