-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ts
More file actions
29 lines (23 loc) · 734 Bytes
/
build.ts
File metadata and controls
29 lines (23 loc) · 734 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
import { compile } from "./lib/compileTs";
import { join } from "path";
import { watch } from "fs";
import { Glob } from "bun";
export default async function build() {
const watcher = watch(
join(import.meta.dir, "./src"),
{ recursive: true },
async (event, filename) => {
console.log(`Detected ${event} in ${filename}`);
if (filename === null) return;
const glob = new Glob("*.{ts,tsx}");
const scannedFiles = await Array.fromAsync(
glob.scan({ cwd: "./src/apps" })
);
scannedFiles.forEach((s) => {
compile("./src/apps/" + s, "./public/dist/apps/");
});
console.log("Built", scannedFiles.length, "app(s).");
}
);
console.log("Watching!");
}