forked from teuchezh/dynamic-weather-card
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ts
More file actions
37 lines (33 loc) · 849 Bytes
/
build.ts
File metadata and controls
37 lines (33 loc) · 849 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
30
31
32
33
34
35
36
37
#!/usr/bin/env bun
import { readFileSync } from 'fs';
// Read version from package.json
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
// Build configuration
const result = await Bun.build({
entrypoints: ['./src/index.ts'],
outdir: './',
naming: 'dynamic-weather-card.js',
target: 'browser',
format: 'esm',
minify: {
syntax: true,
whitespace: true,
identifiers: true
},
sourcemap: 'none',
define: {
__VERSION__: JSON.stringify(pkg.version)
}
});
if (!result.success) {
console.error('Build failed');
for (const message of result.logs) {
console.error(message);
}
process.exit(1);
}
console.log('✅ Build successful!');
console.log(`📦 Output: dynamic-weather-card.js`);
for (const output of result.outputs) {
console.log(` Size: ${(output.size / 1024).toFixed(2)} KB`);
}