create-backon 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +24 -1
- package/package.json +1 -1
- package/src/templates/base.ts +14 -3
- package/src/templates/db.ts +16 -1
package/dist/cli.js
CHANGED
|
@@ -250,6 +250,8 @@ export const db = drizzle(sql, { schema });
|
|
|
250
250
|
"@neondatabase/serverless": "^0.10.4"
|
|
251
251
|
},
|
|
252
252
|
devDependencies: DRIZZLE_KIT_DEV_DEPENDENCY,
|
|
253
|
+
// @neondatabase/serverless ships its own types — no @types/* needed.
|
|
254
|
+
typeOnlyDevDependencies: {},
|
|
253
255
|
envVars: "DATABASE_URL=postgres://user:password@ep-example-123456.us-east-2.aws.neon.tech/dbname?sslmode=require\n",
|
|
254
256
|
readmeNote: "Uses Neon's HTTP driver \u2014 no connection pooling to manage, which is what makes it safe to use from serverless functions (e.g. Vercel).",
|
|
255
257
|
hasSchemaSupport: true
|
|
@@ -278,6 +280,11 @@ export const db = drizzle(pool, { schema });
|
|
|
278
280
|
pg: "^8.13.1"
|
|
279
281
|
},
|
|
280
282
|
devDependencies: DRIZZLE_KIT_DEV_DEPENDENCY,
|
|
283
|
+
// pg doesn't ship its own types (unlike @neondatabase/serverless) — without
|
|
284
|
+
// this, a freshly scaffolded TypeScript "postgres" project fails
|
|
285
|
+
// `tsc --noEmit` out of the box with TS7016 on `import { Pool } from "pg"`.
|
|
286
|
+
// Caught via a real `bun run typecheck` on a real scaffold, not assumed.
|
|
287
|
+
typeOnlyDevDependencies: { "@types/pg": "^8.23.1" },
|
|
281
288
|
envVars: "DATABASE_URL=postgres://user:password@localhost:5432/dbname\n",
|
|
282
289
|
readmeNote: "Pooled Postgres connection \u2014 fine for local dev or a long-running server, NOT safe as-is on Vercel serverless functions (connection pool exhaustion on cold starts). Use Neon for serverless deploys.",
|
|
283
290
|
hasSchemaSupport: true
|
|
@@ -297,6 +304,7 @@ export const db = drizzle(sqlite);
|
|
|
297
304
|
"drizzle-orm": "^0.38.2"
|
|
298
305
|
},
|
|
299
306
|
devDependencies: {},
|
|
307
|
+
typeOnlyDevDependencies: {},
|
|
300
308
|
envVars: "DATABASE_URL=./dev.db\n",
|
|
301
309
|
readmeNote: "Local file-based SQLite \u2014 for local dev only, not for a serverless deploy target. No schema.ts/add-table support yet \u2014 SQLite uses a different set of drizzle-orm column builders (sqlite-core, not pg-core), hand-write a schema with drizzle-orm/sqlite-core if you need one.",
|
|
302
310
|
hasSchemaSupport: false
|
|
@@ -312,6 +320,7 @@ export const db = undefined;
|
|
|
312
320
|
`,
|
|
313
321
|
dependencies: {},
|
|
314
322
|
devDependencies: {},
|
|
323
|
+
typeOnlyDevDependencies: {},
|
|
315
324
|
envVars: "",
|
|
316
325
|
readmeNote: "No database configured. src/config/db.ts is an empty stub.",
|
|
317
326
|
hasSchemaSupport: false
|
|
@@ -326,6 +335,9 @@ function dbDependencies(db) {
|
|
|
326
335
|
function dbDevDependencies(db) {
|
|
327
336
|
return TEMPLATES[db].devDependencies;
|
|
328
337
|
}
|
|
338
|
+
function dbTypeOnlyDevDependencies(db) {
|
|
339
|
+
return TEMPLATES[db].typeOnlyDevDependencies;
|
|
340
|
+
}
|
|
329
341
|
function dbEnvVars(db) {
|
|
330
342
|
return TEMPLATES[db].envVars;
|
|
331
343
|
}
|
|
@@ -720,7 +732,18 @@ function renderPackageJson(projectName, framework, language, db) {
|
|
|
720
732
|
zod: "^3.24.1",
|
|
721
733
|
...dbDependencies(db)
|
|
722
734
|
};
|
|
723
|
-
const devDependencies = language === "javascript" ? { ...dbDevDependencies(db) } : framework === "express" ? {
|
|
735
|
+
const devDependencies = language === "javascript" ? { ...dbDevDependencies(db) } : framework === "express" ? {
|
|
736
|
+
"@types/bun": "latest",
|
|
737
|
+
"@types/express": "^4.17.21",
|
|
738
|
+
typescript: "^5.7.2",
|
|
739
|
+
...dbDevDependencies(db),
|
|
740
|
+
...dbTypeOnlyDevDependencies(db)
|
|
741
|
+
} : {
|
|
742
|
+
"@types/bun": "latest",
|
|
743
|
+
typescript: "^5.7.2",
|
|
744
|
+
...dbDevDependencies(db),
|
|
745
|
+
...dbTypeOnlyDevDependencies(db)
|
|
746
|
+
};
|
|
724
747
|
const scripts = {
|
|
725
748
|
dev: `bun run --watch index.${ext}`,
|
|
726
749
|
start: `bun run index.${ext}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-backon",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Scaffolds a new backend project on backon — like `bun create vite@latest`, but for a consistent controller/routes/services backend layout. Runs via bunx/bun create or npx/npm create.",
|
|
6
6
|
"license": "MIT",
|
package/src/templates/base.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Answers, DeployTarget, Framework, Language } from "../prompts";
|
|
2
2
|
import { camelCase } from "./route";
|
|
3
|
-
import { dbDependencies, dbDevDependencies, dbEnvVars, dbHasSchemaSupport, dbReadmeNote } from "./db";
|
|
3
|
+
import { dbDependencies, dbDevDependencies, dbEnvVars, dbHasSchemaSupport, dbReadmeNote, dbTypeOnlyDevDependencies } from "./db";
|
|
4
4
|
|
|
5
5
|
// renderIndexTs/renderAppTs/renderEndpointsIndex are intentionally NOT
|
|
6
6
|
// language-aware: none of them contain TypeScript-only syntax (no type
|
|
@@ -507,8 +507,19 @@ export function renderPackageJson(
|
|
|
507
507
|
language === "javascript"
|
|
508
508
|
? { ...dbDevDependencies(db) }
|
|
509
509
|
: framework === "express"
|
|
510
|
-
? {
|
|
511
|
-
|
|
510
|
+
? {
|
|
511
|
+
"@types/bun": "latest",
|
|
512
|
+
"@types/express": "^4.17.21",
|
|
513
|
+
typescript: "^5.7.2",
|
|
514
|
+
...dbDevDependencies(db),
|
|
515
|
+
...dbTypeOnlyDevDependencies(db),
|
|
516
|
+
}
|
|
517
|
+
: {
|
|
518
|
+
"@types/bun": "latest",
|
|
519
|
+
typescript: "^5.7.2",
|
|
520
|
+
...dbDevDependencies(db),
|
|
521
|
+
...dbTypeOnlyDevDependencies(db),
|
|
522
|
+
};
|
|
512
523
|
|
|
513
524
|
const scripts: Record<string, string> = {
|
|
514
525
|
dev: `bun run --watch index.${ext}`,
|
package/src/templates/db.ts
CHANGED
|
@@ -5,8 +5,10 @@ export interface DbTemplate {
|
|
|
5
5
|
file: string;
|
|
6
6
|
/** Extra runtime dependencies the generated package.json needs. */
|
|
7
7
|
dependencies: Record<string, string>;
|
|
8
|
-
/** Extra dev-only dependencies the generated package.json needs (drizzle-kit — a CLI tool, not runtime code). */
|
|
8
|
+
/** Extra dev-only dependencies the generated package.json needs (drizzle-kit — a CLI tool, not runtime code). Merged in regardless of language, same as `dependencies`. */
|
|
9
9
|
devDependencies: Record<string, string>;
|
|
10
|
+
/** Extra dev-only *type declaration* dependencies (e.g. @types/pg) — merged in for TypeScript projects only, mirroring how @types/bun/@types/express are already excluded from JavaScript-mode devDependencies in renderPackageJson(). */
|
|
11
|
+
typeOnlyDevDependencies: Record<string, string>;
|
|
10
12
|
/** Line(s) appended to .env.example. */
|
|
11
13
|
envVars: string;
|
|
12
14
|
/** One-line note surfaced in the generated README so the caveats aren't silently lost. */
|
|
@@ -40,6 +42,8 @@ export const db = drizzle(sql, { schema });
|
|
|
40
42
|
"@neondatabase/serverless": "^0.10.4",
|
|
41
43
|
},
|
|
42
44
|
devDependencies: DRIZZLE_KIT_DEV_DEPENDENCY,
|
|
45
|
+
// @neondatabase/serverless ships its own types — no @types/* needed.
|
|
46
|
+
typeOnlyDevDependencies: {},
|
|
43
47
|
envVars: "DATABASE_URL=postgres://user:password@ep-example-123456.us-east-2.aws.neon.tech/dbname?sslmode=require\n",
|
|
44
48
|
readmeNote:
|
|
45
49
|
"Uses Neon's HTTP driver — no connection pooling to manage, which is what makes it safe to use from serverless functions (e.g. Vercel).",
|
|
@@ -69,6 +73,11 @@ export const db = drizzle(pool, { schema });
|
|
|
69
73
|
pg: "^8.13.1",
|
|
70
74
|
},
|
|
71
75
|
devDependencies: DRIZZLE_KIT_DEV_DEPENDENCY,
|
|
76
|
+
// pg doesn't ship its own types (unlike @neondatabase/serverless) — without
|
|
77
|
+
// this, a freshly scaffolded TypeScript "postgres" project fails
|
|
78
|
+
// `tsc --noEmit` out of the box with TS7016 on `import { Pool } from "pg"`.
|
|
79
|
+
// Caught via a real `bun run typecheck` on a real scaffold, not assumed.
|
|
80
|
+
typeOnlyDevDependencies: { "@types/pg": "^8.23.1" },
|
|
72
81
|
envVars: "DATABASE_URL=postgres://user:password@localhost:5432/dbname\n",
|
|
73
82
|
readmeNote:
|
|
74
83
|
"Pooled Postgres connection — fine for local dev or a long-running server, NOT safe as-is on Vercel serverless functions (connection pool exhaustion on cold starts). Use Neon for serverless deploys.",
|
|
@@ -89,6 +98,7 @@ export const db = drizzle(sqlite);
|
|
|
89
98
|
"drizzle-orm": "^0.38.2",
|
|
90
99
|
},
|
|
91
100
|
devDependencies: {},
|
|
101
|
+
typeOnlyDevDependencies: {},
|
|
92
102
|
envVars: "DATABASE_URL=./dev.db\n",
|
|
93
103
|
readmeNote:
|
|
94
104
|
"Local file-based SQLite — for local dev only, not for a serverless deploy target. No schema.ts/add-table support yet — SQLite uses a different set of drizzle-orm column builders (sqlite-core, not pg-core), hand-write a schema with drizzle-orm/sqlite-core if you need one.",
|
|
@@ -105,6 +115,7 @@ export const db = undefined;
|
|
|
105
115
|
`,
|
|
106
116
|
dependencies: {},
|
|
107
117
|
devDependencies: {},
|
|
118
|
+
typeOnlyDevDependencies: {},
|
|
108
119
|
envVars: "",
|
|
109
120
|
readmeNote: "No database configured. src/config/db.ts is an empty stub.",
|
|
110
121
|
hasSchemaSupport: false,
|
|
@@ -123,6 +134,10 @@ export function dbDevDependencies(db: DbChoice): Record<string, string> {
|
|
|
123
134
|
return TEMPLATES[db].devDependencies;
|
|
124
135
|
}
|
|
125
136
|
|
|
137
|
+
export function dbTypeOnlyDevDependencies(db: DbChoice): Record<string, string> {
|
|
138
|
+
return TEMPLATES[db].typeOnlyDevDependencies;
|
|
139
|
+
}
|
|
140
|
+
|
|
126
141
|
export function dbEnvVars(db: DbChoice): string {
|
|
127
142
|
return TEMPLATES[db].envVars;
|
|
128
143
|
}
|