create-runlot 0.1.0-rc.76 → 0.1.0-rc.78
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 +35 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
import { existsSync, mkdirSync, realpathSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join, resolve, sep } from "node:path";
|
|
6
6
|
import { createInterface } from "node:readline/promises";
|
|
7
|
+
var POSTS_MIGRATION = [
|
|
8
|
+
"-- Applied by `runlot deploy` (and by `runlot pg migrate`).",
|
|
9
|
+
"create table if not exists posts (",
|
|
10
|
+
" id serial primary key,",
|
|
11
|
+
" owner text not null,",
|
|
12
|
+
" title text not null",
|
|
13
|
+
");",
|
|
14
|
+
"",
|
|
15
|
+
"-- One row so the example page has something to show before you write any.",
|
|
16
|
+
"insert into posts (owner, title)",
|
|
17
|
+
"select 'welcome', 'Your first post'",
|
|
18
|
+
"where not exists (select 1 from posts);",
|
|
19
|
+
""
|
|
20
|
+
].join("\n");
|
|
7
21
|
var TEMPLATE_NAMES = ["next", "hono", "static"];
|
|
8
22
|
function isTemplateName(v) {
|
|
9
23
|
return TEMPLATE_NAMES.includes(v);
|
|
@@ -148,8 +162,8 @@ function nextTemplate(ctx) {
|
|
|
148
162
|
"react-dom": "^19.2.8",
|
|
149
163
|
// The npm job in release.yml rewrites the version range with the same
|
|
150
164
|
// number as the tag — the value written here is the last published version.
|
|
151
|
-
"@runlot/next": "^0.1.0-rc.
|
|
152
|
-
"@runlot/pg": "^0.1.0-rc.
|
|
165
|
+
"@runlot/next": "^0.1.0-rc.78",
|
|
166
|
+
"@runlot/pg": "^0.1.0-rc.78"
|
|
153
167
|
},
|
|
154
168
|
devDependencies: {
|
|
155
169
|
typescript: "^5.7.2",
|
|
@@ -166,6 +180,7 @@ function nextTemplate(ctx) {
|
|
|
166
180
|
"app/layout.tsx": nextLayoutTsx(name),
|
|
167
181
|
"app/page.tsx": NEXT_PAGE_TSX,
|
|
168
182
|
"public/robots.txt": "User-agent: *\nAllow: /\n",
|
|
183
|
+
"migrations/0001_posts.sql": POSTS_MIGRATION,
|
|
169
184
|
// runlot deploy writes the generated OpenNext configuration into
|
|
170
185
|
// `.runlot-next` (docs/nextjs.md §2) — it is not source, so it is not
|
|
171
186
|
// something to commit.
|
|
@@ -184,12 +199,21 @@ var HONO_INDEX_TS = [
|
|
|
184
199
|
" db: Db;",
|
|
185
200
|
" auth: AuthBinding;",
|
|
186
201
|
" storage: Storage;",
|
|
202
|
+
" // public/ ships in the same bundle and is served through this.",
|
|
203
|
+
" assets: { fetch(request: Request): Promise<Response> };",
|
|
187
204
|
"}",
|
|
188
205
|
"",
|
|
189
206
|
"const app = new Hono<{ Bindings: Env }>();",
|
|
190
207
|
"",
|
|
191
208
|
'app.get("/posts", async (c) => {',
|
|
192
209
|
" const user = await c.env.auth.user(c.req.raw);",
|
|
210
|
+
" // `user` is null until someone signs in, which is every first visit. The",
|
|
211
|
+
" // landing sample leaves this out because it is for display; a project that",
|
|
212
|
+
" // runs cannot (field-notes #69).",
|
|
213
|
+
" if (!user) {",
|
|
214
|
+
' return c.json({ error: "sign in at /__runlot/auth/sign-in" }, 401);',
|
|
215
|
+
" }",
|
|
216
|
+
"",
|
|
193
217
|
" const db = new Pool({ db: c.env.db });",
|
|
194
218
|
"",
|
|
195
219
|
" const { rows } = await db.query(",
|
|
@@ -206,6 +230,12 @@ var HONO_INDEX_TS = [
|
|
|
206
230
|
" return c.json({ url });",
|
|
207
231
|
"});",
|
|
208
232
|
"",
|
|
233
|
+
"// With `main` set, the worker is the entry point and static files are not",
|
|
234
|
+
"// served ahead of it \u2014 so whatever the routes above did not answer is handed",
|
|
235
|
+
"// to the assets binding. Without this line public/hello.txt is a 404, which",
|
|
236
|
+
"// is what the template shipped until field-notes #71.",
|
|
237
|
+
'app.all("*", (c) => c.env.assets.fetch(c.req.raw));',
|
|
238
|
+
"",
|
|
209
239
|
"export default app;",
|
|
210
240
|
""
|
|
211
241
|
].join("\n");
|
|
@@ -241,8 +271,8 @@ function honoTemplate(ctx) {
|
|
|
241
271
|
type: "module",
|
|
242
272
|
dependencies: {
|
|
243
273
|
hono: "^4.10.7",
|
|
244
|
-
"@runlot/pg": "^0.1.0-rc.
|
|
245
|
-
"@runlot/auth": "^0.1.0-rc.
|
|
274
|
+
"@runlot/pg": "^0.1.0-rc.78",
|
|
275
|
+
"@runlot/auth": "^0.1.0-rc.78"
|
|
246
276
|
},
|
|
247
277
|
devDependencies: {
|
|
248
278
|
typescript: "^5.7.2",
|
|
@@ -267,6 +297,7 @@ function honoTemplate(ctx) {
|
|
|
267
297
|
"tsconfig.json": tsconfig,
|
|
268
298
|
"src/index.ts": HONO_INDEX_TS,
|
|
269
299
|
"public/hello.txt": "Static assets ship in the same bundle.\n",
|
|
300
|
+
"migrations/0001_posts.sql": POSTS_MIGRATION,
|
|
270
301
|
".gitignore": "node_modules\n",
|
|
271
302
|
"README.md": honoReadme(name)
|
|
272
303
|
};
|
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.78",
|
|
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.78"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=20"
|