-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.ts
41 lines (39 loc) · 878 Bytes
/
build.ts
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
import { build } from 'tsup';
import * as esbuild from 'esbuild';
import fs from 'fs/promises';
import { replace } from 'esbuild-plugin-replace';
await Promise.all([
build({
entry: {
'cli/index': 'src/cli/index.ts',
'client/index': 'src/client/index.ts',
},
dts: {
resolve: true,
},
format: ['cjs', 'esm'],
splitting: false,
treeshake: true,
external: ['@drizzle-team/tento', /^@shopify\//],
tsconfig: 'src/tsconfig.json',
}),
esbuild.build({
entryPoints: ['src/cli/cli.ts'],
outfile: 'dist/cli/cli.cjs',
bundle: true,
format: 'cjs',
platform: 'node',
target: 'node18',
minify: true,
external: ['@drizzle-team/tento'],
banner: {
js: '#!/usr/bin/env -S node --loader=tsx --no-warnings',
},
plugins: [
replace({
'await import': 'require',
}),
],
}),
]);
await fs.copyFile('package.json', 'dist/package.json');