mirror of
https://github.com/JackyKLai/kunkun-ext-letterboxd.git
synced 2025-04-03 01:36:44 +00:00
25 lines
567 B
TypeScript
25 lines
567 B
TypeScript
import { watch } from "fs"
|
|
import { join } from "path"
|
|
import { refreshTemplateWorkerCommand } from "@kksh/api/dev"
|
|
import { $ } from "bun"
|
|
|
|
async function build() {
|
|
try {
|
|
await $`bun build --minify --target=browser --outdir=./dist ./src/index.ts`
|
|
await refreshTemplateWorkerCommand()
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
}
|
|
|
|
const srcDir = join(import.meta.dir, "src")
|
|
|
|
await build()
|
|
|
|
if (Bun.argv.includes("dev")) {
|
|
console.log(`Watching ${srcDir} for changes...`)
|
|
watch(srcDir, { recursive: true }, async (event, filename) => {
|
|
await build()
|
|
})
|
|
}
|