-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
66 lines (58 loc) · 1.7 KB
/
vite.config.js
File metadata and controls
66 lines (58 loc) · 1.7 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
import { exec } from 'child_process';
import { promisify } from 'util';
import { defineConfig } from 'vite';
const execAsync = promisify(exec);
let lastBuild = 0;
async function runKist(server) {
const now = Date.now();
if (now - lastBuild < 500) return;
lastBuild = now;
console.log('[Kist] 🛠️ Running build...');
try {
const { stdout, stderr } = await execAsync('npx kist --config ./kist.dev.yml');
if (stdout) console.log('[Kist] stdout:', stdout);
if (stderr) console.error('[Kist] stderr:', stderr);
console.log('[Kist] Build complete');
setTimeout(() => {
server?.ws.send({
type: 'full-reload',
path: '*'
});
}, 200);
} catch (err) {
console.error('[Kist] Build failed:', err.stderr || err.message);
}
}
export default defineConfig({
root: '.',
publicDir: false,
server: {
port: 3001,
open: true,
fs: { strict: false },
},
plugins: [
{
name: 'kist-watch',
configureServer(server) {
runKist(server);
// Watch for file changes to trigger kist rebuild
server.watcher.on('change', (file) => {
if (file.includes('/src/') || file.includes('kist.')) {
runKist(server);
}
});
},
},
],
test: {
globals: true,
environment: 'node',
include: ['test/**/*.{test,spec}.{js,ts}'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
include: ['src/ts/**/*.ts'],
},
},
});