This commit is contained in:
728
2024-12-07 13:30:04 +08:00
parent c731e3ad57
commit 87fbe74a1c
8 changed files with 393 additions and 18 deletions
+14 -5
View File
@@ -1,11 +1,20 @@
set -e
rm -rf trg
if [ -d trg ]; then
rm -r trg
fi
mkdir trg
cp -r tst/md trg/tst
# cp -r tst/md trg/tst
deno check ui/bind/bind.ts
deno -A cli/bundle.ts $1 src/bind.ts
# deno check ui/bind/bind.ts
# deno -A cli/bundle.ts $1 src/bind.ts
deno run -A ui/ui.ts
# deno run -A ui/ui.ts
cp ui/todo/index.html trg
deno check ui/todo/bind.tsx
deno -A cli/bundle.ts $1 ui/todo/bind.tsx
ls -sk trg
+4 -5
View File
@@ -1,16 +1,15 @@
import { denoSpecifierPlugin } from "jsr:@miyauci/esbuild-deno-specifier@1.0.0-beta.14"
import { build, stop } from "https://deno.land/x/esbuild@v0.24.0/mod.js"
import { denoPlugins } from "@duesabati/esbuild-deno-plugin"
import { build, stop } from "esbuild"
const src = Deno.args.filter(a => !a.startsWith("-"))
const minify = Deno.args.some(a => a == "-m")
await build({
plugins: [denoSpecifierPlugin()],
bundle: true,
minify: minify,
bundle: true, minify,
entryPoints: src,
format: "esm",
outdir: "trg",
plugins: [...denoPlugins()],
})
await stop()
+14
View File
@@ -0,0 +1,14 @@
import { serveDir } from "jsr:@std/http/file-server"
if (!Deno.execPath().endsWith("deno")) Deno.chdir(Deno.execPath())
const root = "trg"
console.log(`serving ${Deno.cwd()}/${root}`)
Deno.serve({ port: 8080 }, async req => {
const res = await serveDir(req, { fsRoot: root })
if (res.status == 200 && req.url.endsWith(".js"))
res.headers.set("Content-Type", "text/javascript")
return res
})