create-jant 0.3.13 → 0.3.15
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/README.md +10 -10
- package/dist/index.js +2 -1
- package/package.json +1 -1
- package/template/README.md +39 -25
- package/template/package.json +3 -3
- package/template/scripts/seed-demo.sql +2 -2
package/README.md
CHANGED
|
@@ -71,16 +71,16 @@ my-site/
|
|
|
71
71
|
## Scripts
|
|
72
72
|
|
|
73
73
|
```bash
|
|
74
|
-
pnpm dev
|
|
75
|
-
pnpm build
|
|
76
|
-
pnpm
|
|
77
|
-
pnpm typecheck
|
|
78
|
-
pnpm lint
|
|
79
|
-
pnpm format
|
|
80
|
-
pnpm db:generate
|
|
81
|
-
pnpm db:migrate:local
|
|
82
|
-
pnpm db:migrate:remote
|
|
83
|
-
pnpm i18n:build
|
|
74
|
+
pnpm dev # Start dev server (http://localhost:9019)
|
|
75
|
+
pnpm build # Build for production
|
|
76
|
+
pnpm run deploy # Build + deploy to Cloudflare Workers
|
|
77
|
+
pnpm typecheck # Run TypeScript checks
|
|
78
|
+
pnpm lint # Run ESLint
|
|
79
|
+
pnpm format # Format code with Prettier
|
|
80
|
+
pnpm db:generate # Generate Drizzle migrations
|
|
81
|
+
pnpm db:migrate:local # Apply migrations (local)
|
|
82
|
+
pnpm db:migrate:remote # Apply migrations (production)
|
|
83
|
+
pnpm i18n:build # Extract + compile translations
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
## License
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import path from "path";
|
|
|
9
9
|
import { fileURLToPath } from "url";
|
|
10
10
|
var __filename = fileURLToPath(import.meta.url);
|
|
11
11
|
var __dirname = path.dirname(__filename);
|
|
12
|
-
var CORE_VERSION = "0.3.
|
|
12
|
+
var CORE_VERSION = "0.3.15";
|
|
13
13
|
var TEMPLATE_DIR = fs.existsSync(path.resolve(__dirname, "../template")) ? path.resolve(__dirname, "../template") : path.resolve(__dirname, "../../../templates/jant-site");
|
|
14
14
|
function isValidProjectName(name) {
|
|
15
15
|
return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(name);
|
|
@@ -91,6 +91,7 @@ async function copyTemplate(config) {
|
|
|
91
91
|
if (basename === "reset-local.sql") return false;
|
|
92
92
|
if (basename === "seed-local.sql") return false;
|
|
93
93
|
if (basename === "export-demo.mjs") return false;
|
|
94
|
+
if (basename === "export-seed.mjs") return false;
|
|
94
95
|
return true;
|
|
95
96
|
}
|
|
96
97
|
});
|
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A personal website/blog powered by [Jant](https://github.com/jant-me/jant).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Local Development
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
pnpm dev
|
|
@@ -12,7 +12,19 @@ Visit http://localhost:9019 to see your site.
|
|
|
12
12
|
|
|
13
13
|
## Deploy to Cloudflare
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### Option A: One-Click Deploy
|
|
16
|
+
|
|
17
|
+
[](https://deploy.workers.cloudflare.com/?url=https://github.com/jant-me/jant-starter)
|
|
18
|
+
|
|
19
|
+
Click the button, name your Worker, D1 database, and R2 bucket, set `AUTH_SECRET` (32+ random characters), and you're done!
|
|
20
|
+
|
|
21
|
+
After deploying, set `SITE_URL` in Cloudflare dashboard → your Worker → Settings → Variables.
|
|
22
|
+
|
|
23
|
+
> If you deployed via the button, skip to [Custom Domain](#custom-domain-optional).
|
|
24
|
+
|
|
25
|
+
### Option B: Manual Deployment
|
|
26
|
+
|
|
27
|
+
#### 1. Prerequisites
|
|
16
28
|
|
|
17
29
|
Install [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/) and log in:
|
|
18
30
|
|
|
@@ -20,7 +32,7 @@ Install [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/instal
|
|
|
20
32
|
wrangler login
|
|
21
33
|
```
|
|
22
34
|
|
|
23
|
-
|
|
35
|
+
#### 2. Create D1 Database
|
|
24
36
|
|
|
25
37
|
Check the `database_name` in your `wrangler.toml` (defaults to `<your-project>-db`), then create it:
|
|
26
38
|
|
|
@@ -29,18 +41,18 @@ wrangler d1 create <your-project>-db
|
|
|
29
41
|
# Copy the database_id from the output!
|
|
30
42
|
```
|
|
31
43
|
|
|
32
|
-
|
|
44
|
+
#### 3. Update Configuration
|
|
33
45
|
|
|
34
46
|
Edit `wrangler.toml`:
|
|
35
47
|
|
|
36
48
|
- Replace `database_id = "local"` with the ID from step 2
|
|
37
|
-
- Set `SITE_URL` to your production URL
|
|
49
|
+
- Set `SITE_URL` to your production URL (e.g. `https://example.com`)
|
|
38
50
|
|
|
39
51
|
> R2 bucket is automatically created on first deploy — no manual setup needed.
|
|
40
52
|
>
|
|
41
|
-
> **Note:** Changing `database_id` resets your local development database (local data is stored per database ID).
|
|
53
|
+
> **Note:** Changing `database_id` resets your local development database (local data is stored per database ID). If you've already started local development, you'll need to go through the setup wizard again to create your admin account.
|
|
42
54
|
|
|
43
|
-
|
|
55
|
+
#### 4. Set Production Secrets
|
|
44
56
|
|
|
45
57
|
Generate a production secret and save it somewhere safe (you'll need it again for CI):
|
|
46
58
|
|
|
@@ -55,19 +67,16 @@ wrangler secret put AUTH_SECRET
|
|
|
55
67
|
|
|
56
68
|
> **Important:** This is separate from the `AUTH_SECRET` in `.dev.vars` (which is for local development only). Do not change the production secret after your site is live — it will invalidate all sessions. If you get locked out, use `pnpm reset-password` to generate a password reset link.
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
#### 5. Deploy
|
|
59
71
|
|
|
60
72
|
```bash
|
|
61
|
-
# Apply database migrations
|
|
62
|
-
pnpm
|
|
63
|
-
|
|
64
|
-
# Build and deploy
|
|
65
|
-
pnpm cf:deploy
|
|
73
|
+
# Apply database migrations and deploy
|
|
74
|
+
pnpm run deploy
|
|
66
75
|
```
|
|
67
76
|
|
|
68
77
|
Your site is now live at `https://<your-project>.<your-subdomain>.workers.dev`!
|
|
69
78
|
|
|
70
|
-
###
|
|
79
|
+
### Custom Domain (Optional)
|
|
71
80
|
|
|
72
81
|
1. Go to [Cloudflare Dashboard](https://dash.cloudflare.com) → Workers & Pages
|
|
73
82
|
2. Select your worker → Settings → Domains & Routes
|
|
@@ -75,7 +84,7 @@ Your site is now live at `https://<your-project>.<your-subdomain>.workers.dev`!
|
|
|
75
84
|
|
|
76
85
|
## GitHub Actions (CI/CD)
|
|
77
86
|
|
|
78
|
-
A workflow file is included at `.github/workflows/deploy.yml`. Complete the [manual deployment](#
|
|
87
|
+
A workflow file is included at `.github/workflows/deploy.yml`. Complete the [manual deployment](#option-b-manual-deployment) first, then set up CI for automatic deployments.
|
|
79
88
|
|
|
80
89
|
> Runtime secrets (`AUTH_SECRET`, S3 keys, etc.) are already stored in Cloudflare from the manual deployment step. CI only needs deployment credentials.
|
|
81
90
|
|
|
@@ -86,7 +95,7 @@ Create a new repository on [GitHub](https://github.com/new), then commit and pus
|
|
|
86
95
|
```bash
|
|
87
96
|
git add -A
|
|
88
97
|
git commit -m "Initial setup"
|
|
89
|
-
git remote add origin
|
|
98
|
+
git remote add origin git@github.com:<your-username>/<your-repo>.git
|
|
90
99
|
git push -u origin main
|
|
91
100
|
```
|
|
92
101
|
|
|
@@ -148,17 +157,23 @@ jobs:
|
|
|
148
157
|
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
|
149
158
|
```
|
|
150
159
|
|
|
160
|
+
### Cloudflare Workers Builds (Alternative CI/CD)
|
|
161
|
+
|
|
162
|
+
Workers Builds is auto-configured if you used the [One-Click Deploy](#option-a-one-click-deploy) button. To enable auto-deploy on push, go to Cloudflare dashboard → Workers → your worker → Settings → Builds.
|
|
163
|
+
|
|
151
164
|
## Commands
|
|
152
165
|
|
|
153
166
|
| Command | Description |
|
|
154
167
|
| ------------------------ | ---------------------------------- |
|
|
155
168
|
| `pnpm dev` | Start development server |
|
|
156
169
|
| `pnpm build` | Build for production |
|
|
157
|
-
| `pnpm
|
|
170
|
+
| `pnpm run deploy` | Migrate, build, and deploy |
|
|
158
171
|
| `pnpm preview` | Preview production build |
|
|
159
172
|
| `pnpm typecheck` | Run TypeScript checks |
|
|
160
173
|
| `pnpm db:migrate:remote` | Apply database migrations (remote) |
|
|
161
174
|
|
|
175
|
+
> `deploy` uses `pnpm run deploy` because `pnpm deploy` is a built-in pnpm command. All other scripts work with or without `run`.
|
|
176
|
+
|
|
162
177
|
## Environment Variables
|
|
163
178
|
|
|
164
179
|
| Variable | Description | Location |
|
|
@@ -235,20 +250,19 @@ export default createApp({
|
|
|
235
250
|
## Updating
|
|
236
251
|
|
|
237
252
|
```bash
|
|
238
|
-
# Update @jant/core
|
|
239
|
-
pnpm
|
|
253
|
+
# Update @jant/core to latest version
|
|
254
|
+
pnpm add @jant/core@latest
|
|
240
255
|
|
|
241
256
|
# Start dev server (auto-applies migrations locally)
|
|
242
257
|
pnpm dev
|
|
243
258
|
|
|
244
|
-
#
|
|
245
|
-
pnpm
|
|
246
|
-
|
|
247
|
-
# Deploy
|
|
248
|
-
pnpm cf:deploy
|
|
259
|
+
# Deploy (includes remote migrations)
|
|
260
|
+
pnpm run deploy
|
|
249
261
|
```
|
|
250
262
|
|
|
251
|
-
> New versions of `@jant/core` may include database migrations.
|
|
263
|
+
> New versions of `@jant/core` may include database migrations. Check the [release notes](https://github.com/jant-me/jant/releases) for any breaking changes.
|
|
264
|
+
>
|
|
265
|
+
> **Dev dependencies** (vite, wrangler, tailwindcss, etc.) may also need updating. Compare your `devDependencies` with the [latest template](https://github.com/jant-me/jant/blob/main/templates/jant-site/package.json) and update if needed.
|
|
252
266
|
|
|
253
267
|
## Documentation
|
|
254
268
|
|
package/template/package.json
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.28.2",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"dev": "pnpm db:migrate:local && vite dev",
|
|
9
|
-
"dev:debug": "pnpm db:migrate:local && vite dev --port 19019",
|
|
8
|
+
"dev": "pnpm run db:migrate:local && vite dev",
|
|
9
|
+
"dev:debug": "pnpm run db:migrate:local && vite dev --port 19019",
|
|
10
10
|
"build": "vite build",
|
|
11
|
-
"
|
|
11
|
+
"deploy": "pnpm run db:migrate:remote && pnpm run build && wrangler deploy",
|
|
12
12
|
"preview": "vite preview",
|
|
13
13
|
"typecheck": "tsc --noEmit",
|
|
14
14
|
"db:migrate:local": "yes | wrangler d1 migrations apply DB --local",
|
|
@@ -82,7 +82,7 @@ cd my-blog
|
|
|
82
82
|
pnpm dev
|
|
83
83
|
|
|
84
84
|
# Deploy to Cloudflare
|
|
85
|
-
pnpm
|
|
85
|
+
pnpm run deploy
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
## Documentation
|
|
@@ -147,7 +147,7 @@ cd my-blog
|
|
|
147
147
|
pnpm dev
|
|
148
148
|
|
|
149
149
|
# Deploy to Cloudflare
|
|
150
|
-
pnpm
|
|
150
|
+
pnpm run deploy
|
|
151
151
|
</code></pre>
|
|
152
152
|
<h2>Documentation</h2>
|
|
153
153
|
<ul>
|