cli create: updated templates, reworked examples to be standalone

This commit is contained in:
dswbx
2025-02-14 14:56:35 +01:00
parent b412da836c
commit 4bd201d454
18 changed files with 85 additions and 106 deletions

View File

@@ -1,27 +0,0 @@
import { $ } from "bun";
//import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill";
import esbuild from "esbuild";
const result = await esbuild.build({
//plugins: [NodeModulesPolyfillPlugin()],
platform: "browser",
conditions: ["worker", "browser"],
entryPoints: ["./src/index.ts"],
outdir: "dist",
external: ["__STATIC_CONTENT_MANIFEST", "cloudflare:workers"],
format: "esm",
target: "es2022",
keepNames: true,
bundle: true,
metafile: true,
minify: true,
loader: {
".html": "copy"
},
define: {
IS_CLOUDFLARE_WORKER: "true"
}
});
await Bun.write("dist/meta.json", JSON.stringify(result.metafile));
await $`gzip dist/index.js -c > dist/index.js.gz`;

View File

@@ -4,19 +4,17 @@
"private": true,
"scripts": {
"deploy": "wrangler deploy",
"db": "turso dev",
"dev": "wrangler dev",
"start": "wrangler dev",
"test": "vitest",
"cf-typegen": "wrangler types"
},
"dependencies": {
"bknd": "workspace:*",
"bknd": "file:../../app",
"kysely-d1": "^0.3.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241106.0",
"typescript": "^5.5.2",
"wrangler": "^3.86.0"
"@cloudflare/workers-types": "^4.20240620.0",
"typescript": "^5.5.3",
"wrangler": "^3.108.1"
}
}

View File

@@ -1,20 +0,0 @@
#:schema node_modules/wrangler/config-schema.json
name = "bknd-cf-worker-example"
main = "src/index.ts"
compatibility_date = "2025-02-04"
compatibility_flags = ["nodejs_compat"]
workers_dev = true
minify = true
assets = { directory = "../../app/dist/static" }
[observability]
enabled = true
[[d1_databases]]
binding = "DB"
database_name = "bknd-cf-example"
database_id = "7ad67953-2bbf-47fc-8696-f4517dbfe674"
[[r2_buckets]]
binding = "BUCKET"
bucket_name = "bknd-cf-example"