-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.ts
More file actions
executable file
·45 lines (36 loc) · 1.03 KB
/
run.ts
File metadata and controls
executable file
·45 lines (36 loc) · 1.03 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
#!/usr/bin/env ./bootstrap.sh
import {$} from "bun";
process.env.FORCE_COLOR = "1";
export async function install() {
await $`go install -tags=duckdb_arrow github.com/uwdata/mosaic/packages/server/duckdb-server-go@latest`;
}
export async function server() {
await install();
await $`duckdb-server-go --port 3001`;
}
export async function build() {
await $`docker build -t data-viz .`;
}
export async function run() {
await build();
await $`docker run -p 3001:3001 data-viz`;
}
export async function wrangler(...args: string[]) {
await $`bunx wrangler ${args}`
}
export async function deploy() {
await wrangler('deploy')
}
const command = process.argv[2] || 'run';
const args = process.argv.slice(3);
try {
await eval(command)(...args);
} catch (e: any) {
if (e instanceof ReferenceError) {
const { exitCode } = await $`${command} ${args}`.nothrow();
process.exit(exitCode);
} else {
console.error('Command failed:', command, ...args, e.message);
process.exit(1);
}
}