diff options
| author | Joe Mou <dev@mou.fo> | 2026-07-15 02:08:17 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-07-15 02:08:29 -0400 |
| commit | 9b556ffe6c0c0528697e15f7f4f35107de212ce1 (patch) | |
| tree | 7f87bd7d58c4bc9a640a669fa314fec6c49c82df /cgithub/package.json | |
| parent | 9fbb5f0d68a131b55bc172d46b75705f2842af04 (diff) | |
Add Cloudflare Workers deployment target
Split routes into a shared createApp() (src/app.ts) used by both the
Node entry (src/index.ts) and a new Workers entry (src/worker.ts).
Workers disallow runtime code generation, so scripts/compile-views.ts
precompiles the Eta templates into src/views.generated.ts and rendering
switches from renderAsync to the sync render. Static files move to
public/static so Workers Static Assets can serve them; the Node build
and serveStatic root are updated to match.
Deploy with pnpm run deploy:cf, local dev with pnpm run dev:cf.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'cgithub/package.json')
| -rw-r--r-- | cgithub/package.json | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cgithub/package.json b/cgithub/package.json index 06e2876..b5349ca 100644 --- a/cgithub/package.json +++ b/cgithub/package.json @@ -6,8 +6,10 @@ "type": "module", "scripts": { "dev": "node --watch --watch-preserve-output src/index.ts", - "build": "rm -rf dist/* && esbuild --bundle --format=esm --platform=node --outdir=dist/build --sourcemap src/index.ts && cp -R static views dist/", - "test": "node --test --test-concurrency=4 src/scraper.test.ts" + "build": "rm -rf dist/* && esbuild --bundle --format=esm --platform=node --outdir=dist/build --sourcemap src/index.ts && cp -R public views dist/", + "test": "node --test --test-concurrency=4 src/scraper.test.ts", + "dev:cf": "node scripts/compile-views.ts && wrangler dev", + "deploy:cf": "node scripts/compile-views.ts && wrangler deploy" }, "dependencies": { "@hono/node-server": "^1.13.7", @@ -18,10 +20,14 @@ "hono": "^4.6.14", "htmlparser2": "^10.1.0" }, + "pnpm": { + "onlyBuiltDependencies": ["esbuild", "workerd"] + }, "devDependencies": { "@types/node": "^22.10.2", "esbuild": "^0.27.2", "prettier": "^3.8.1", - "typescript": "^5.7.2" + "typescript": "^5.7.2", + "wrangler": "^4.110.0" } } |
