-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.mjs
More file actions
62 lines (59 loc) · 1.15 KB
/
Copy pathbuild.mjs
File metadata and controls
62 lines (59 loc) · 1.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
import * as esbuild from 'esbuild';
import { cp } from 'node:fs/promises';
await esbuild.build({
entryPoints: ['./bin/diffray.ts'],
bundle: true,
platform: 'node',
target: 'node18',
format: 'cjs',
outfile: 'dist/diffray.cjs',
minify: true,
banner: {
js: '#!/usr/bin/env node',
},
external: [
// Node.js built-ins (both bare and node: prefix)
'fs',
'path',
'child_process',
'os',
'url',
'util',
'stream',
'events',
'readline',
'process',
'tty',
'buffer',
'assert',
'crypto',
'http',
'https',
'net',
'zlib',
'string_decoder',
'node:fs',
'node:path',
'node:child_process',
'node:os',
'node:url',
'node:util',
'node:stream',
'node:events',
'node:readline',
'node:process',
'node:tty',
'node:buffer',
'node:assert',
'node:crypto',
'node:http',
'node:https',
'node:net',
'node:zlib',
'node:string_decoder',
'node:fs/promises',
],
});
// Copy defaults directory (cross-platform)
await cp('src/defaults', 'dist/defaults', { recursive: true });
console.log('Build completed: dist/diffray.cjs');