create-runlot 0.1.0-rc.74 → 0.1.0-rc.76
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/index.js +26 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { existsSync, mkdirSync, realpathSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { dirname, join, resolve, sep } from "node:path";
|
|
6
6
|
import { createInterface } from "node:readline/promises";
|
|
7
7
|
var TEMPLATE_NAMES = ["next", "hono", "static"];
|
|
8
8
|
function isTemplateName(v) {
|
|
@@ -74,6 +74,11 @@ var NEXT_PAGE_TSX = [
|
|
|
74
74
|
'import { Pool } from "@runlot/pg";',
|
|
75
75
|
'import { env } from "@runlot/next";',
|
|
76
76
|
"",
|
|
77
|
+
"// `env` is request-scoped. Without this, Next prerenders this page during",
|
|
78
|
+
"// `next build`, where there is no request, and the build fails on the",
|
|
79
|
+
"// adapter's own error (field-notes #68).",
|
|
80
|
+
'export const dynamic = "force-dynamic";',
|
|
81
|
+
"",
|
|
77
82
|
"export default async function PostsPage() {",
|
|
78
83
|
" const user = await env.auth.user();",
|
|
79
84
|
" if (!user) {",
|
|
@@ -86,7 +91,10 @@ var NEXT_PAGE_TSX = [
|
|
|
86
91
|
"",
|
|
87
92
|
" const db = new Pool({ db: env.db });",
|
|
88
93
|
"",
|
|
89
|
-
|
|
94
|
+
// `query` defaults its row type to Record<string, unknown>. Without the type
|
|
95
|
+
// argument `p.id` and `p.title` are `unknown`, and `next build` — which type
|
|
96
|
+
// checks — fails before the bundler is ever reached.
|
|
97
|
+
" const { rows } = await db.query<{ id: number; title: string }>(",
|
|
90
98
|
' "select id, title from posts where owner = $1 limit 20",',
|
|
91
99
|
" [user.id],",
|
|
92
100
|
" );",
|
|
@@ -140,8 +148,8 @@ function nextTemplate(ctx) {
|
|
|
140
148
|
"react-dom": "^19.2.8",
|
|
141
149
|
// The npm job in release.yml rewrites the version range with the same
|
|
142
150
|
// number as the tag — the value written here is the last published version.
|
|
143
|
-
"@runlot/next": "^0.1.0-rc.
|
|
144
|
-
"@runlot/pg": "^0.1.0-rc.
|
|
151
|
+
"@runlot/next": "^0.1.0-rc.76",
|
|
152
|
+
"@runlot/pg": "^0.1.0-rc.76"
|
|
145
153
|
},
|
|
146
154
|
devDependencies: {
|
|
147
155
|
typescript: "^5.7.2",
|
|
@@ -233,8 +241,8 @@ function honoTemplate(ctx) {
|
|
|
233
241
|
type: "module",
|
|
234
242
|
dependencies: {
|
|
235
243
|
hono: "^4.10.7",
|
|
236
|
-
"@runlot/pg": "^0.1.0-rc.
|
|
237
|
-
"@runlot/auth": "^0.1.0-rc.
|
|
244
|
+
"@runlot/pg": "^0.1.0-rc.76",
|
|
245
|
+
"@runlot/auth": "^0.1.0-rc.76"
|
|
238
246
|
},
|
|
239
247
|
devDependencies: {
|
|
240
248
|
typescript: "^5.7.2",
|
|
@@ -411,10 +419,20 @@ async function main(argv, deps = {}) {
|
|
|
411
419
|
return 1;
|
|
412
420
|
}
|
|
413
421
|
}
|
|
414
|
-
|
|
422
|
+
function runDirectly(argv1) {
|
|
423
|
+
if (!argv1) return false;
|
|
424
|
+
let path = argv1;
|
|
425
|
+
try {
|
|
426
|
+
path = realpathSync(argv1);
|
|
427
|
+
} catch {
|
|
428
|
+
}
|
|
429
|
+
return path.endsWith(`${sep}dist${sep}index.js`);
|
|
430
|
+
}
|
|
431
|
+
if (runDirectly(process.argv[1])) {
|
|
415
432
|
main(process.argv.slice(2)).then((code) => process.exit(code));
|
|
416
433
|
}
|
|
417
434
|
export {
|
|
418
435
|
main,
|
|
436
|
+
runDirectly,
|
|
419
437
|
scaffold
|
|
420
438
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-runlot",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.76",
|
|
4
4
|
"description": "npm create runlot — Next.js, Hono, and static-site templates",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"esbuild": "^0.24.2",
|
|
22
22
|
"typescript": "^5.7.2",
|
|
23
23
|
"@types/node": "^22.10.2",
|
|
24
|
-
"@runlot/config": "0.1.0-rc.
|
|
24
|
+
"@runlot/config": "0.1.0-rc.76"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=20"
|