create-jant 0.1.24 → 0.2.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/index.js CHANGED
@@ -8,7 +8,7 @@ import path from "path";
8
8
  import { fileURLToPath } from "url";
9
9
  var __filename = fileURLToPath(import.meta.url);
10
10
  var __dirname = path.dirname(__filename);
11
- var CORE_VERSION = "0.2.21";
11
+ var CORE_VERSION = "0.3.4";
12
12
  var TEMPLATE_DIR = fs.existsSync(path.resolve(__dirname, "../template")) ? path.resolve(__dirname, "../template") : path.resolve(__dirname, "../../../templates/jant-site");
13
13
  function isValidProjectName(name) {
14
14
  return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(name);
@@ -32,6 +32,8 @@ async function copyTemplate(config) {
32
32
  if (basename === "pnpm-lock.yaml") return false;
33
33
  if (basename === "dist") return false;
34
34
  if (basename === "wrangler.demo.toml") return false;
35
+ if (basename === "reset.sql") return false;
36
+ if (basename === "seed.sql") return false;
35
37
  return true;
36
38
  }
37
39
  });
@@ -59,14 +61,16 @@ async function copyTemplate(config) {
59
61
  const wranglerPath = path.join(targetDir, "wrangler.toml");
60
62
  if (await fs.pathExists(wranglerPath)) {
61
63
  let content = await fs.readFile(wranglerPath, "utf-8");
62
- content = content.replace(/name = "jant-site"/g, `name = "${projectName}"`);
64
+ const vars = { name: projectName };
63
65
  content = content.replace(
64
- /database_name = "jant-site-db"/g,
65
- `database_name = "${projectName}-db"`
66
- );
67
- content = content.replace(
68
- /bucket_name = "jant-site-media"/g,
69
- `bucket_name = "${projectName}-media"`
66
+ /^(.+=\s*)"[^"]*"\s*#\s*@create-jant:\s*"([^"]*)"/gm,
67
+ (_, prefix, template) => {
68
+ const value = template.replace(
69
+ /\$\{(\w+)\}/g,
70
+ (__, key) => vars[key] ?? ""
71
+ );
72
+ return `${prefix}"${value}"`;
73
+ }
70
74
  );
71
75
  await fs.writeFile(wranglerPath, content, "utf-8");
72
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-jant",
3
- "version": "0.1.24",
3
+ "version": "0.2.1",
4
4
  "description": "Create a new Jant project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -179,7 +179,7 @@ Core environment variables:
179
179
 
180
180
  For a complete list of all available environment variables (site configuration, R2 storage, image optimization, demo mode, etc.), see:
181
181
 
182
- **[📖 Full Configuration Guide](../../docs/configuration.md)**
182
+ **[📖 Full Configuration Guide](https://github.com/nicepkg/jant/blob/main/docs/configuration.md)**
183
183
 
184
184
  ## Customization
185
185
 
@@ -247,12 +247,32 @@ export default createApp({
247
247
 
248
248
  ## Updating
249
249
 
250
- To update Jant to the latest version:
250
+ 1. Update the `@jant/core` package:
251
251
 
252
252
  ```bash
253
253
  pnpm update @jant/core
254
254
  ```
255
255
 
256
+ 2. Apply database migrations locally (this happens automatically when you run `pnpm dev`):
257
+
258
+ ```bash
259
+ pnpm dev
260
+ ```
261
+
262
+ 3. Before deploying to production, apply migrations to your remote D1 database:
263
+
264
+ ```bash
265
+ pnpm db:migrate:remote
266
+ ```
267
+
268
+ 4. Deploy:
269
+
270
+ ```bash
271
+ pnpm deploy
272
+ ```
273
+
274
+ > **Note:** New versions of `@jant/core` may include database migrations. Always run `pnpm db:migrate:remote` before deploying after an update. Check the [release notes](https://github.com/nicepkg/jant/releases) for any breaking changes.
275
+
256
276
  ## Documentation
257
277
 
258
278
  - [Jant Documentation](https://jant.me/docs)
@@ -14,8 +14,8 @@ DEMO_PASSWORD = "demodemo"
14
14
  [[d1_databases]]
15
15
  binding = "DB"
16
16
  database_name = "jant-demo-db"
17
- database_id = "fb835831-d594-4b2f-be54-ce036cf7f2b1"
18
- migrations_dir = "migrations"
17
+ database_id = "76329154-291d-4580-af73-aa77397649f1"
18
+ migrations_dir = "../../packages/core/src/db/migrations"
19
19
 
20
20
  [[r2_buckets]]
21
21
  binding = "R2"
@@ -1,4 +1,4 @@
1
- name = "jant-site"
1
+ name = "jant-site" # @create-jant: "${name}"
2
2
  main = "src/index.ts"
3
3
  compatibility_date = "2026-01-20"
4
4
  compatibility_flags = ["nodejs_compat"]
@@ -22,7 +22,7 @@ SITE_URL = "http://localhost:9019"
22
22
  # Optional: Site configuration
23
23
  # These can be overridden in dashboard settings (/dash/settings)
24
24
  # If not set, values from database settings table are used
25
- SITE_NAME = "My Blog 2"
25
+ # SITE_NAME = "My Blog"
26
26
  # SITE_DESCRIPTION = "A personal blog powered by Jant"
27
27
  # SITE_LANGUAGE = "en"
28
28
 
@@ -39,10 +39,10 @@ SITE_NAME = "My Blog 2"
39
39
 
40
40
  [[d1_databases]]
41
41
  binding = "DB"
42
- database_name = "jant-site-db"
42
+ database_name = "jant-site-db" # @create-jant: "${name}-db"
43
43
  database_id = "local"
44
- migrations_dir = "migrations"
44
+ migrations_dir = "../../packages/core/src/db/migrations" # @create-jant: "node_modules/@jant/core/src/db/migrations"
45
45
 
46
46
  [[r2_buckets]]
47
47
  binding = "R2"
48
- bucket_name = "jant-site-media"
48
+ bucket_name = "jant-site-media" # @create-jant: "${name}-media"
@@ -1,118 +0,0 @@
1
- CREATE TABLE `account` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `account_id` text NOT NULL,
4
- `provider_id` text NOT NULL,
5
- `user_id` text NOT NULL,
6
- `access_token` text,
7
- `refresh_token` text,
8
- `id_token` text,
9
- `access_token_expires_at` integer,
10
- `refresh_token_expires_at` integer,
11
- `scope` text,
12
- `password` text,
13
- `created_at` integer NOT NULL,
14
- `updated_at` integer NOT NULL,
15
- FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
16
- );
17
- --> statement-breakpoint
18
- CREATE TABLE `collections` (
19
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
20
- `path` text,
21
- `title` text NOT NULL,
22
- `description` text,
23
- `created_at` integer NOT NULL,
24
- `updated_at` integer NOT NULL
25
- );
26
- --> statement-breakpoint
27
- CREATE UNIQUE INDEX `collections_path_unique` ON `collections` (`path`);--> statement-breakpoint
28
- CREATE TABLE `media` (
29
- `id` text PRIMARY KEY NOT NULL,
30
- `post_id` integer,
31
- `filename` text NOT NULL,
32
- `original_name` text NOT NULL,
33
- `mime_type` text NOT NULL,
34
- `size` integer NOT NULL,
35
- `r2_key` text NOT NULL,
36
- `width` integer,
37
- `height` integer,
38
- `alt` text,
39
- `created_at` integer NOT NULL,
40
- FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON UPDATE no action ON DELETE no action
41
- );
42
- --> statement-breakpoint
43
- CREATE TABLE `post_collections` (
44
- `post_id` integer NOT NULL,
45
- `collection_id` integer NOT NULL,
46
- `added_at` integer NOT NULL,
47
- PRIMARY KEY(`post_id`, `collection_id`),
48
- FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON UPDATE no action ON DELETE no action,
49
- FOREIGN KEY (`collection_id`) REFERENCES `collections`(`id`) ON UPDATE no action ON DELETE no action
50
- );
51
- --> statement-breakpoint
52
- CREATE TABLE `posts` (
53
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
54
- `type` text NOT NULL,
55
- `visibility` text DEFAULT 'quiet' NOT NULL,
56
- `title` text,
57
- `path` text,
58
- `content` text,
59
- `content_html` text,
60
- `source_url` text,
61
- `source_name` text,
62
- `source_domain` text,
63
- `reply_to_id` integer,
64
- `thread_id` integer,
65
- `deleted_at` integer,
66
- `published_at` integer NOT NULL,
67
- `created_at` integer NOT NULL,
68
- `updated_at` integer NOT NULL
69
- );
70
- --> statement-breakpoint
71
- CREATE TABLE `redirects` (
72
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
73
- `from_path` text NOT NULL,
74
- `to_path` text NOT NULL,
75
- `type` integer DEFAULT 301 NOT NULL,
76
- `created_at` integer NOT NULL
77
- );
78
- --> statement-breakpoint
79
- CREATE UNIQUE INDEX `redirects_from_path_unique` ON `redirects` (`from_path`);--> statement-breakpoint
80
- CREATE TABLE `session` (
81
- `id` text PRIMARY KEY NOT NULL,
82
- `expires_at` integer NOT NULL,
83
- `token` text NOT NULL,
84
- `created_at` integer NOT NULL,
85
- `updated_at` integer NOT NULL,
86
- `ip_address` text,
87
- `user_agent` text,
88
- `user_id` text NOT NULL,
89
- FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
90
- );
91
- --> statement-breakpoint
92
- CREATE UNIQUE INDEX `session_token_unique` ON `session` (`token`);--> statement-breakpoint
93
- CREATE TABLE `settings` (
94
- `key` text PRIMARY KEY NOT NULL,
95
- `value` text NOT NULL,
96
- `updated_at` integer NOT NULL
97
- );
98
- --> statement-breakpoint
99
- CREATE TABLE `user` (
100
- `id` text PRIMARY KEY NOT NULL,
101
- `name` text NOT NULL,
102
- `email` text NOT NULL,
103
- `email_verified` integer DEFAULT false NOT NULL,
104
- `image` text,
105
- `role` text DEFAULT 'admin',
106
- `created_at` integer NOT NULL,
107
- `updated_at` integer NOT NULL
108
- );
109
- --> statement-breakpoint
110
- CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
111
- CREATE TABLE `verification` (
112
- `id` text PRIMARY KEY NOT NULL,
113
- `identifier` text NOT NULL,
114
- `value` text NOT NULL,
115
- `expires_at` integer NOT NULL,
116
- `created_at` integer,
117
- `updated_at` integer
118
- );
@@ -1,753 +0,0 @@
1
- {
2
- "version": "6",
3
- "dialect": "sqlite",
4
- "id": "3d04f8ef-088d-43f4-9fe9-55ffa2d7a73f",
5
- "prevId": "00000000-0000-0000-0000-000000000000",
6
- "tables": {
7
- "account": {
8
- "name": "account",
9
- "columns": {
10
- "id": {
11
- "name": "id",
12
- "type": "text",
13
- "primaryKey": true,
14
- "notNull": true,
15
- "autoincrement": false
16
- },
17
- "account_id": {
18
- "name": "account_id",
19
- "type": "text",
20
- "primaryKey": false,
21
- "notNull": true,
22
- "autoincrement": false
23
- },
24
- "provider_id": {
25
- "name": "provider_id",
26
- "type": "text",
27
- "primaryKey": false,
28
- "notNull": true,
29
- "autoincrement": false
30
- },
31
- "user_id": {
32
- "name": "user_id",
33
- "type": "text",
34
- "primaryKey": false,
35
- "notNull": true,
36
- "autoincrement": false
37
- },
38
- "access_token": {
39
- "name": "access_token",
40
- "type": "text",
41
- "primaryKey": false,
42
- "notNull": false,
43
- "autoincrement": false
44
- },
45
- "refresh_token": {
46
- "name": "refresh_token",
47
- "type": "text",
48
- "primaryKey": false,
49
- "notNull": false,
50
- "autoincrement": false
51
- },
52
- "id_token": {
53
- "name": "id_token",
54
- "type": "text",
55
- "primaryKey": false,
56
- "notNull": false,
57
- "autoincrement": false
58
- },
59
- "access_token_expires_at": {
60
- "name": "access_token_expires_at",
61
- "type": "integer",
62
- "primaryKey": false,
63
- "notNull": false,
64
- "autoincrement": false
65
- },
66
- "refresh_token_expires_at": {
67
- "name": "refresh_token_expires_at",
68
- "type": "integer",
69
- "primaryKey": false,
70
- "notNull": false,
71
- "autoincrement": false
72
- },
73
- "scope": {
74
- "name": "scope",
75
- "type": "text",
76
- "primaryKey": false,
77
- "notNull": false,
78
- "autoincrement": false
79
- },
80
- "password": {
81
- "name": "password",
82
- "type": "text",
83
- "primaryKey": false,
84
- "notNull": false,
85
- "autoincrement": false
86
- },
87
- "created_at": {
88
- "name": "created_at",
89
- "type": "integer",
90
- "primaryKey": false,
91
- "notNull": true,
92
- "autoincrement": false
93
- },
94
- "updated_at": {
95
- "name": "updated_at",
96
- "type": "integer",
97
- "primaryKey": false,
98
- "notNull": true,
99
- "autoincrement": false
100
- }
101
- },
102
- "indexes": {},
103
- "foreignKeys": {
104
- "account_user_id_user_id_fk": {
105
- "name": "account_user_id_user_id_fk",
106
- "tableFrom": "account",
107
- "tableTo": "user",
108
- "columnsFrom": ["user_id"],
109
- "columnsTo": ["id"],
110
- "onDelete": "no action",
111
- "onUpdate": "no action"
112
- }
113
- },
114
- "compositePrimaryKeys": {},
115
- "uniqueConstraints": {},
116
- "checkConstraints": {}
117
- },
118
- "collections": {
119
- "name": "collections",
120
- "columns": {
121
- "id": {
122
- "name": "id",
123
- "type": "integer",
124
- "primaryKey": true,
125
- "notNull": true,
126
- "autoincrement": true
127
- },
128
- "path": {
129
- "name": "path",
130
- "type": "text",
131
- "primaryKey": false,
132
- "notNull": false,
133
- "autoincrement": false
134
- },
135
- "title": {
136
- "name": "title",
137
- "type": "text",
138
- "primaryKey": false,
139
- "notNull": true,
140
- "autoincrement": false
141
- },
142
- "description": {
143
- "name": "description",
144
- "type": "text",
145
- "primaryKey": false,
146
- "notNull": false,
147
- "autoincrement": false
148
- },
149
- "created_at": {
150
- "name": "created_at",
151
- "type": "integer",
152
- "primaryKey": false,
153
- "notNull": true,
154
- "autoincrement": false
155
- },
156
- "updated_at": {
157
- "name": "updated_at",
158
- "type": "integer",
159
- "primaryKey": false,
160
- "notNull": true,
161
- "autoincrement": false
162
- }
163
- },
164
- "indexes": {
165
- "collections_path_unique": {
166
- "name": "collections_path_unique",
167
- "columns": ["path"],
168
- "isUnique": true
169
- }
170
- },
171
- "foreignKeys": {},
172
- "compositePrimaryKeys": {},
173
- "uniqueConstraints": {},
174
- "checkConstraints": {}
175
- },
176
- "media": {
177
- "name": "media",
178
- "columns": {
179
- "id": {
180
- "name": "id",
181
- "type": "text",
182
- "primaryKey": true,
183
- "notNull": true,
184
- "autoincrement": false
185
- },
186
- "post_id": {
187
- "name": "post_id",
188
- "type": "integer",
189
- "primaryKey": false,
190
- "notNull": false,
191
- "autoincrement": false
192
- },
193
- "filename": {
194
- "name": "filename",
195
- "type": "text",
196
- "primaryKey": false,
197
- "notNull": true,
198
- "autoincrement": false
199
- },
200
- "original_name": {
201
- "name": "original_name",
202
- "type": "text",
203
- "primaryKey": false,
204
- "notNull": true,
205
- "autoincrement": false
206
- },
207
- "mime_type": {
208
- "name": "mime_type",
209
- "type": "text",
210
- "primaryKey": false,
211
- "notNull": true,
212
- "autoincrement": false
213
- },
214
- "size": {
215
- "name": "size",
216
- "type": "integer",
217
- "primaryKey": false,
218
- "notNull": true,
219
- "autoincrement": false
220
- },
221
- "r2_key": {
222
- "name": "r2_key",
223
- "type": "text",
224
- "primaryKey": false,
225
- "notNull": true,
226
- "autoincrement": false
227
- },
228
- "width": {
229
- "name": "width",
230
- "type": "integer",
231
- "primaryKey": false,
232
- "notNull": false,
233
- "autoincrement": false
234
- },
235
- "height": {
236
- "name": "height",
237
- "type": "integer",
238
- "primaryKey": false,
239
- "notNull": false,
240
- "autoincrement": false
241
- },
242
- "alt": {
243
- "name": "alt",
244
- "type": "text",
245
- "primaryKey": false,
246
- "notNull": false,
247
- "autoincrement": false
248
- },
249
- "created_at": {
250
- "name": "created_at",
251
- "type": "integer",
252
- "primaryKey": false,
253
- "notNull": true,
254
- "autoincrement": false
255
- }
256
- },
257
- "indexes": {},
258
- "foreignKeys": {
259
- "media_post_id_posts_id_fk": {
260
- "name": "media_post_id_posts_id_fk",
261
- "tableFrom": "media",
262
- "tableTo": "posts",
263
- "columnsFrom": ["post_id"],
264
- "columnsTo": ["id"],
265
- "onDelete": "no action",
266
- "onUpdate": "no action"
267
- }
268
- },
269
- "compositePrimaryKeys": {},
270
- "uniqueConstraints": {},
271
- "checkConstraints": {}
272
- },
273
- "post_collections": {
274
- "name": "post_collections",
275
- "columns": {
276
- "post_id": {
277
- "name": "post_id",
278
- "type": "integer",
279
- "primaryKey": false,
280
- "notNull": true,
281
- "autoincrement": false
282
- },
283
- "collection_id": {
284
- "name": "collection_id",
285
- "type": "integer",
286
- "primaryKey": false,
287
- "notNull": true,
288
- "autoincrement": false
289
- },
290
- "added_at": {
291
- "name": "added_at",
292
- "type": "integer",
293
- "primaryKey": false,
294
- "notNull": true,
295
- "autoincrement": false
296
- }
297
- },
298
- "indexes": {},
299
- "foreignKeys": {
300
- "post_collections_post_id_posts_id_fk": {
301
- "name": "post_collections_post_id_posts_id_fk",
302
- "tableFrom": "post_collections",
303
- "tableTo": "posts",
304
- "columnsFrom": ["post_id"],
305
- "columnsTo": ["id"],
306
- "onDelete": "no action",
307
- "onUpdate": "no action"
308
- },
309
- "post_collections_collection_id_collections_id_fk": {
310
- "name": "post_collections_collection_id_collections_id_fk",
311
- "tableFrom": "post_collections",
312
- "tableTo": "collections",
313
- "columnsFrom": ["collection_id"],
314
- "columnsTo": ["id"],
315
- "onDelete": "no action",
316
- "onUpdate": "no action"
317
- }
318
- },
319
- "compositePrimaryKeys": {
320
- "post_collections_post_id_collection_id_pk": {
321
- "columns": ["post_id", "collection_id"],
322
- "name": "post_collections_post_id_collection_id_pk"
323
- }
324
- },
325
- "uniqueConstraints": {},
326
- "checkConstraints": {}
327
- },
328
- "posts": {
329
- "name": "posts",
330
- "columns": {
331
- "id": {
332
- "name": "id",
333
- "type": "integer",
334
- "primaryKey": true,
335
- "notNull": true,
336
- "autoincrement": true
337
- },
338
- "type": {
339
- "name": "type",
340
- "type": "text",
341
- "primaryKey": false,
342
- "notNull": true,
343
- "autoincrement": false
344
- },
345
- "visibility": {
346
- "name": "visibility",
347
- "type": "text",
348
- "primaryKey": false,
349
- "notNull": true,
350
- "autoincrement": false,
351
- "default": "'quiet'"
352
- },
353
- "title": {
354
- "name": "title",
355
- "type": "text",
356
- "primaryKey": false,
357
- "notNull": false,
358
- "autoincrement": false
359
- },
360
- "path": {
361
- "name": "path",
362
- "type": "text",
363
- "primaryKey": false,
364
- "notNull": false,
365
- "autoincrement": false
366
- },
367
- "content": {
368
- "name": "content",
369
- "type": "text",
370
- "primaryKey": false,
371
- "notNull": false,
372
- "autoincrement": false
373
- },
374
- "content_html": {
375
- "name": "content_html",
376
- "type": "text",
377
- "primaryKey": false,
378
- "notNull": false,
379
- "autoincrement": false
380
- },
381
- "source_url": {
382
- "name": "source_url",
383
- "type": "text",
384
- "primaryKey": false,
385
- "notNull": false,
386
- "autoincrement": false
387
- },
388
- "source_name": {
389
- "name": "source_name",
390
- "type": "text",
391
- "primaryKey": false,
392
- "notNull": false,
393
- "autoincrement": false
394
- },
395
- "source_domain": {
396
- "name": "source_domain",
397
- "type": "text",
398
- "primaryKey": false,
399
- "notNull": false,
400
- "autoincrement": false
401
- },
402
- "reply_to_id": {
403
- "name": "reply_to_id",
404
- "type": "integer",
405
- "primaryKey": false,
406
- "notNull": false,
407
- "autoincrement": false
408
- },
409
- "thread_id": {
410
- "name": "thread_id",
411
- "type": "integer",
412
- "primaryKey": false,
413
- "notNull": false,
414
- "autoincrement": false
415
- },
416
- "deleted_at": {
417
- "name": "deleted_at",
418
- "type": "integer",
419
- "primaryKey": false,
420
- "notNull": false,
421
- "autoincrement": false
422
- },
423
- "published_at": {
424
- "name": "published_at",
425
- "type": "integer",
426
- "primaryKey": false,
427
- "notNull": true,
428
- "autoincrement": false
429
- },
430
- "created_at": {
431
- "name": "created_at",
432
- "type": "integer",
433
- "primaryKey": false,
434
- "notNull": true,
435
- "autoincrement": false
436
- },
437
- "updated_at": {
438
- "name": "updated_at",
439
- "type": "integer",
440
- "primaryKey": false,
441
- "notNull": true,
442
- "autoincrement": false
443
- }
444
- },
445
- "indexes": {},
446
- "foreignKeys": {},
447
- "compositePrimaryKeys": {},
448
- "uniqueConstraints": {},
449
- "checkConstraints": {}
450
- },
451
- "redirects": {
452
- "name": "redirects",
453
- "columns": {
454
- "id": {
455
- "name": "id",
456
- "type": "integer",
457
- "primaryKey": true,
458
- "notNull": true,
459
- "autoincrement": true
460
- },
461
- "from_path": {
462
- "name": "from_path",
463
- "type": "text",
464
- "primaryKey": false,
465
- "notNull": true,
466
- "autoincrement": false
467
- },
468
- "to_path": {
469
- "name": "to_path",
470
- "type": "text",
471
- "primaryKey": false,
472
- "notNull": true,
473
- "autoincrement": false
474
- },
475
- "type": {
476
- "name": "type",
477
- "type": "integer",
478
- "primaryKey": false,
479
- "notNull": true,
480
- "autoincrement": false,
481
- "default": 301
482
- },
483
- "created_at": {
484
- "name": "created_at",
485
- "type": "integer",
486
- "primaryKey": false,
487
- "notNull": true,
488
- "autoincrement": false
489
- }
490
- },
491
- "indexes": {
492
- "redirects_from_path_unique": {
493
- "name": "redirects_from_path_unique",
494
- "columns": ["from_path"],
495
- "isUnique": true
496
- }
497
- },
498
- "foreignKeys": {},
499
- "compositePrimaryKeys": {},
500
- "uniqueConstraints": {},
501
- "checkConstraints": {}
502
- },
503
- "session": {
504
- "name": "session",
505
- "columns": {
506
- "id": {
507
- "name": "id",
508
- "type": "text",
509
- "primaryKey": true,
510
- "notNull": true,
511
- "autoincrement": false
512
- },
513
- "expires_at": {
514
- "name": "expires_at",
515
- "type": "integer",
516
- "primaryKey": false,
517
- "notNull": true,
518
- "autoincrement": false
519
- },
520
- "token": {
521
- "name": "token",
522
- "type": "text",
523
- "primaryKey": false,
524
- "notNull": true,
525
- "autoincrement": false
526
- },
527
- "created_at": {
528
- "name": "created_at",
529
- "type": "integer",
530
- "primaryKey": false,
531
- "notNull": true,
532
- "autoincrement": false
533
- },
534
- "updated_at": {
535
- "name": "updated_at",
536
- "type": "integer",
537
- "primaryKey": false,
538
- "notNull": true,
539
- "autoincrement": false
540
- },
541
- "ip_address": {
542
- "name": "ip_address",
543
- "type": "text",
544
- "primaryKey": false,
545
- "notNull": false,
546
- "autoincrement": false
547
- },
548
- "user_agent": {
549
- "name": "user_agent",
550
- "type": "text",
551
- "primaryKey": false,
552
- "notNull": false,
553
- "autoincrement": false
554
- },
555
- "user_id": {
556
- "name": "user_id",
557
- "type": "text",
558
- "primaryKey": false,
559
- "notNull": true,
560
- "autoincrement": false
561
- }
562
- },
563
- "indexes": {
564
- "session_token_unique": {
565
- "name": "session_token_unique",
566
- "columns": ["token"],
567
- "isUnique": true
568
- }
569
- },
570
- "foreignKeys": {
571
- "session_user_id_user_id_fk": {
572
- "name": "session_user_id_user_id_fk",
573
- "tableFrom": "session",
574
- "tableTo": "user",
575
- "columnsFrom": ["user_id"],
576
- "columnsTo": ["id"],
577
- "onDelete": "no action",
578
- "onUpdate": "no action"
579
- }
580
- },
581
- "compositePrimaryKeys": {},
582
- "uniqueConstraints": {},
583
- "checkConstraints": {}
584
- },
585
- "settings": {
586
- "name": "settings",
587
- "columns": {
588
- "key": {
589
- "name": "key",
590
- "type": "text",
591
- "primaryKey": true,
592
- "notNull": true,
593
- "autoincrement": false
594
- },
595
- "value": {
596
- "name": "value",
597
- "type": "text",
598
- "primaryKey": false,
599
- "notNull": true,
600
- "autoincrement": false
601
- },
602
- "updated_at": {
603
- "name": "updated_at",
604
- "type": "integer",
605
- "primaryKey": false,
606
- "notNull": true,
607
- "autoincrement": false
608
- }
609
- },
610
- "indexes": {},
611
- "foreignKeys": {},
612
- "compositePrimaryKeys": {},
613
- "uniqueConstraints": {},
614
- "checkConstraints": {}
615
- },
616
- "user": {
617
- "name": "user",
618
- "columns": {
619
- "id": {
620
- "name": "id",
621
- "type": "text",
622
- "primaryKey": true,
623
- "notNull": true,
624
- "autoincrement": false
625
- },
626
- "name": {
627
- "name": "name",
628
- "type": "text",
629
- "primaryKey": false,
630
- "notNull": true,
631
- "autoincrement": false
632
- },
633
- "email": {
634
- "name": "email",
635
- "type": "text",
636
- "primaryKey": false,
637
- "notNull": true,
638
- "autoincrement": false
639
- },
640
- "email_verified": {
641
- "name": "email_verified",
642
- "type": "integer",
643
- "primaryKey": false,
644
- "notNull": true,
645
- "autoincrement": false,
646
- "default": false
647
- },
648
- "image": {
649
- "name": "image",
650
- "type": "text",
651
- "primaryKey": false,
652
- "notNull": false,
653
- "autoincrement": false
654
- },
655
- "role": {
656
- "name": "role",
657
- "type": "text",
658
- "primaryKey": false,
659
- "notNull": false,
660
- "autoincrement": false,
661
- "default": "'admin'"
662
- },
663
- "created_at": {
664
- "name": "created_at",
665
- "type": "integer",
666
- "primaryKey": false,
667
- "notNull": true,
668
- "autoincrement": false
669
- },
670
- "updated_at": {
671
- "name": "updated_at",
672
- "type": "integer",
673
- "primaryKey": false,
674
- "notNull": true,
675
- "autoincrement": false
676
- }
677
- },
678
- "indexes": {
679
- "user_email_unique": {
680
- "name": "user_email_unique",
681
- "columns": ["email"],
682
- "isUnique": true
683
- }
684
- },
685
- "foreignKeys": {},
686
- "compositePrimaryKeys": {},
687
- "uniqueConstraints": {},
688
- "checkConstraints": {}
689
- },
690
- "verification": {
691
- "name": "verification",
692
- "columns": {
693
- "id": {
694
- "name": "id",
695
- "type": "text",
696
- "primaryKey": true,
697
- "notNull": true,
698
- "autoincrement": false
699
- },
700
- "identifier": {
701
- "name": "identifier",
702
- "type": "text",
703
- "primaryKey": false,
704
- "notNull": true,
705
- "autoincrement": false
706
- },
707
- "value": {
708
- "name": "value",
709
- "type": "text",
710
- "primaryKey": false,
711
- "notNull": true,
712
- "autoincrement": false
713
- },
714
- "expires_at": {
715
- "name": "expires_at",
716
- "type": "integer",
717
- "primaryKey": false,
718
- "notNull": true,
719
- "autoincrement": false
720
- },
721
- "created_at": {
722
- "name": "created_at",
723
- "type": "integer",
724
- "primaryKey": false,
725
- "notNull": false,
726
- "autoincrement": false
727
- },
728
- "updated_at": {
729
- "name": "updated_at",
730
- "type": "integer",
731
- "primaryKey": false,
732
- "notNull": false,
733
- "autoincrement": false
734
- }
735
- },
736
- "indexes": {},
737
- "foreignKeys": {},
738
- "compositePrimaryKeys": {},
739
- "uniqueConstraints": {},
740
- "checkConstraints": {}
741
- }
742
- },
743
- "views": {},
744
- "enums": {},
745
- "_meta": {
746
- "schemas": {},
747
- "tables": {},
748
- "columns": {}
749
- },
750
- "internal": {
751
- "indexes": {}
752
- }
753
- }
@@ -1,13 +0,0 @@
1
- {
2
- "version": "7",
3
- "dialect": "sqlite",
4
- "entries": [
5
- {
6
- "idx": 0,
7
- "version": "6",
8
- "when": 1770564499811,
9
- "tag": "0000_square_wallflower",
10
- "breakpoints": true
11
- }
12
- ]
13
- }
@@ -1,124 +0,0 @@
1
- # Demo Deployment Scripts
2
-
3
- This directory contains scripts for managing the demo site at demo.jant.me.
4
-
5
- ## Setup
6
-
7
- ### 1. Create Cloudflare Resources
8
-
9
- ```bash
10
- # Create D1 database
11
- wrangler d1 create jant-demo-db
12
- # Output: Created database 'jant-demo-db' with id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
13
-
14
- # Create R2 bucket
15
- wrangler r2 bucket create jant-demo-media
16
- ```
17
-
18
- ### 2. Update wrangler.demo.toml
19
-
20
- Edit `templates/jant-site/wrangler.demo.toml` and replace the placeholder database_id:
21
-
22
- ```toml
23
- [[d1_databases]]
24
- binding = "DB"
25
- database_name = "jant-demo-db"
26
- database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # <-- Your actual ID
27
- ```
28
-
29
- ### 3. Set Secrets
30
-
31
- ```bash
32
- # Set AUTH_SECRET for the demo worker
33
- wrangler secret put AUTH_SECRET --config wrangler.demo.toml
34
- # Enter a random string (32+ characters)
35
- ```
36
-
37
- ### 4. Configure GitHub Secrets
38
-
39
- Add the following secrets to your GitHub repository:
40
-
41
- | Secret | Description |
42
- | ------------------ | --------------------------------------------------------- |
43
- | `CF_API_TOKEN` | Cloudflare API token with Workers, D1, and R2 permissions |
44
- | `CF_ACCOUNT_ID` | Your Cloudflare account ID |
45
- | `DEMO_AUTH_SECRET` | Same value as AUTH_SECRET above |
46
-
47
- ### 5. Set Custom Domain
48
-
49
- In the Cloudflare dashboard:
50
-
51
- 1. Go to Workers & Pages > jant-demo
52
- 2. Settings > Triggers > Custom Domains
53
- 3. Add `demo.jant.me`
54
-
55
- ## Scripts
56
-
57
- ### `reset.sql`
58
-
59
- Clears all user-created data:
60
-
61
- - Posts, media, collections, redirects
62
- - Sessions and verifications
63
- - Preserves settings and user accounts
64
-
65
- ### `seed.sql`
66
-
67
- Inserts demo data:
68
-
69
- - Site settings (name, description, etc.)
70
- - Sample posts (article, note, link, quote)
71
- - Sample collection
72
-
73
- ## Workflows
74
-
75
- ### Deploy Demo (`.github/workflows/deploy-demo.yml`)
76
-
77
- Triggers:
78
-
79
- - Push to `main` branch (when core or template changes)
80
- - Manual dispatch
81
-
82
- Actions:
83
-
84
- - Builds the project
85
- - Deploys to Cloudflare Workers
86
- - Runs database migrations
87
-
88
- ### Reset Demo (`.github/workflows/reset-demo.yml`)
89
-
90
- Triggers:
91
-
92
- - Daily at 00:00 UTC (cron)
93
- - Manual dispatch (requires "reset" confirmation)
94
-
95
- Actions:
96
-
97
- - Clears all user data
98
- - Re-inserts seed data
99
-
100
- ## Manual Operations
101
-
102
- ### Deploy manually
103
-
104
- ```bash
105
- cd templates/jant-site
106
- pnpm build
107
- wrangler deploy --config wrangler.demo.toml
108
- ```
109
-
110
- ### Reset data manually
111
-
112
- ```bash
113
- # Clear data
114
- wrangler d1 execute jant-demo-db --remote --file=scripts/reset.sql
115
-
116
- # Insert seed data
117
- wrangler d1 execute jant-demo-db --remote --file=scripts/seed.sql
118
- ```
119
-
120
- ### Run migrations manually
121
-
122
- ```bash
123
- wrangler d1 migrations apply jant-demo-db --remote
124
- ```