-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbundle.ts
More file actions
38 lines (31 loc) · 819 Bytes
/
bundle.ts
File metadata and controls
38 lines (31 loc) · 819 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
38
import { build, BuildOptions } from 'esbuild';
import { parseEnvVarsAsKeyVal } from './src/utils/env';
import { defined } from './src/defined';
import pkgJson from './package.json';
import type { Defined } from './src/defined';
const external = [
...Object.keys(pkgJson.dependencies),
"aws4",
];
const define = parseEnvVarsAsKeyVal<Defined>({ defined });
const main = async () => {
const buildOptions: BuildOptions = {
entryPoints: ['src/cli.ts'],
define,
bundle: true,
platform: 'node',
target: 'esnext',
outfile: 'dist/bundle.js',
format: 'cjs',
sourcemap: true,
external,
};
try {
await build(buildOptions);
} catch (error) {
console.error('👹 Oops! Failed to bundle for some reason...');
console.error(error);
process.exit(1);
}
};
main();