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

1
examples/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*/package-lock.json

View File

@@ -7,8 +7,6 @@
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"db": "turso dev --db-file test.db",
"db:check": "sqlite3 test.db \"PRAGMA wal_checkpoint(FULL);\"",
"astro": "astro"
},
"dependencies": {
@@ -17,7 +15,7 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"astro": "^4.16.16",
"bknd": "workspace:*",
"bknd": "file:../../app",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.7.2"

View File

@@ -8,10 +8,7 @@ import { type BunBkndConfig, serve } from "bknd/adapter/bun";
const config: BunBkndConfig = {
connection: {
url: ":memory:"
},
// this is only required to run inside the same workspace
// leave blank if you're running this from a different project
distPath: "../../app/dist"
}
};
serve(config);

View File

@@ -4,10 +4,11 @@
"type": "module",
"private": true,
"scripts": {
"dev": "bun run --hot index.ts"
"dev": "bun run --hot index.ts",
"start": "bun run index.ts"
},
"dependencies": {
"bknd": "workspace:*"
"bknd": "file:../../app"
},
"devDependencies": {
"@types/bun": "latest"

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"

View File

@@ -3,20 +3,17 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "npm run db & next dev",
"db": "turso dev --db-file test.db",
"db:check": "sqlite3 test.db \"PRAGMA wal_checkpoint(FULL);\"",
"build": "next build",
"start": "next start",
"start": "npm run db & next start",
"lint": "next lint"
},
"dependencies": {
"bknd": "workspace:*",
"next": "15.0.2"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
"bknd": "file:../../app",
"next": "15.0.2",
"react": "file:../../node_modules/react",
"react-dom": "file:../../node_modules/react-dom"
},
"devDependencies": {
"typescript": "^5",

View File

@@ -8,10 +8,7 @@ import { serve } from "bknd/adapter/node";
const config = {
connection: {
url: ":memory:"
},
// this is only required to run inside the same workspace
// leave blank if you're running this from a different project
distPath: "../../app/dist"
}
};
serve(config);

View File

@@ -8,7 +8,7 @@
"dev": "tsx --watch index.js"
},
"dependencies": {
"bknd": "workspace:*",
"bknd": "file:../../app",
"@hono/node-server": "^1.13.3"
},
"devDependencies": {

View File

@@ -15,10 +15,10 @@
"@remix-run/node": "^2.15.2",
"@remix-run/react": "^2.15.2",
"@remix-run/serve": "^2.15.2",
"bknd": "workspace:*",
"bknd": "file:../../app",
"isbot": "^5.1.18",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "file:../../node_modules/react",
"react-dom": "file:../../node_modules/react-dom",
"remix-utils": "^7.0.0"
},
"devDependencies": {