create-jant 0.3.12 → 0.3.14
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 +1 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
- package/template/README.md +59 -27
- package/template/_github/workflows/deploy.yml +11 -9
- package/template/scripts/seed-demo.sql +2 -2
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ my-site/
|
|
|
73
73
|
```bash
|
|
74
74
|
pnpm dev # Start dev server (http://localhost:9019)
|
|
75
75
|
pnpm build # Build for production
|
|
76
|
-
pnpm deploy # Build + deploy to Cloudflare Workers
|
|
76
|
+
pnpm run deploy # Build + deploy to Cloudflare Workers
|
|
77
77
|
pnpm typecheck # Run TypeScript checks
|
|
78
78
|
pnpm lint # Run ESLint
|
|
79
79
|
pnpm format # Format code with Prettier
|
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.14";
|
|
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
|
|
@@ -10,8 +10,6 @@ pnpm dev
|
|
|
10
10
|
|
|
11
11
|
Visit http://localhost:9019 to see your site.
|
|
12
12
|
|
|
13
|
-
> Your `.dev.vars` file was automatically generated with a secure `AUTH_SECRET`. See `.dev.vars.example` for all available secret variables.
|
|
14
|
-
|
|
15
13
|
## Deploy to Cloudflare
|
|
16
14
|
|
|
17
15
|
### 1. Prerequisites
|
|
@@ -24,13 +22,13 @@ wrangler login
|
|
|
24
22
|
|
|
25
23
|
### 2. Create D1 Database
|
|
26
24
|
|
|
25
|
+
Check the `database_name` in your `wrangler.toml` (defaults to `<your-project>-db`), then create it:
|
|
26
|
+
|
|
27
27
|
```bash
|
|
28
28
|
wrangler d1 create <your-project>-db
|
|
29
29
|
# Copy the database_id from the output!
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Replace `<your-project>` with your project name (must match `database_name` in `wrangler.toml`).
|
|
33
|
-
|
|
34
32
|
### 3. Update Configuration
|
|
35
33
|
|
|
36
34
|
Edit `wrangler.toml`:
|
|
@@ -39,15 +37,24 @@ Edit `wrangler.toml`:
|
|
|
39
37
|
- Set `SITE_URL` to your production URL
|
|
40
38
|
|
|
41
39
|
> R2 bucket is automatically created on first deploy — no manual setup needed.
|
|
40
|
+
>
|
|
41
|
+
> **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
42
|
|
|
43
43
|
### 4. Set Production Secrets
|
|
44
44
|
|
|
45
|
+
Generate a production secret and save it somewhere safe (you'll need it again for CI):
|
|
46
|
+
|
|
45
47
|
```bash
|
|
48
|
+
# Generate a secret
|
|
49
|
+
openssl rand -base64 32
|
|
50
|
+
|
|
51
|
+
# Set it in Cloudflare
|
|
46
52
|
wrangler secret put AUTH_SECRET
|
|
47
|
-
#
|
|
48
|
-
# Generate one with: openssl rand -base64 32
|
|
53
|
+
# Paste the generated value when prompted
|
|
49
54
|
```
|
|
50
55
|
|
|
56
|
+
> **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
|
+
|
|
51
58
|
### 5. Deploy
|
|
52
59
|
|
|
53
60
|
```bash
|
|
@@ -55,16 +62,35 @@ wrangler secret put AUTH_SECRET
|
|
|
55
62
|
pnpm db:migrate:remote
|
|
56
63
|
|
|
57
64
|
# Build and deploy
|
|
58
|
-
pnpm deploy
|
|
65
|
+
pnpm run deploy
|
|
59
66
|
```
|
|
60
67
|
|
|
61
68
|
Your site is now live at `https://<your-project>.<your-subdomain>.workers.dev`!
|
|
62
69
|
|
|
63
|
-
### 6.
|
|
70
|
+
### 6. Custom Domain (Optional)
|
|
64
71
|
|
|
65
|
-
|
|
72
|
+
1. Go to [Cloudflare Dashboard](https://dash.cloudflare.com) → Workers & Pages
|
|
73
|
+
2. Select your worker → Settings → Domains & Routes
|
|
74
|
+
3. Click **Add -> Custom domain** and enter your domain
|
|
75
|
+
|
|
76
|
+
## GitHub Actions (CI/CD)
|
|
77
|
+
|
|
78
|
+
A workflow file is included at `.github/workflows/deploy.yml`. Complete the [manual deployment](#deploy-to-cloudflare) first, then set up CI for automatic deployments.
|
|
66
79
|
|
|
67
|
-
|
|
80
|
+
> Runtime secrets (`AUTH_SECRET`, S3 keys, etc.) are already stored in Cloudflare from the manual deployment step. CI only needs deployment credentials.
|
|
81
|
+
|
|
82
|
+
### 1. Push to GitHub
|
|
83
|
+
|
|
84
|
+
Create a new repository on [GitHub](https://github.com/new), then commit and push your project:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git add -A
|
|
88
|
+
git commit -m "Initial setup"
|
|
89
|
+
git remote add origin https://github.com/<your-username>/<your-repo>.git
|
|
90
|
+
git push -u origin main
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 2. Create API Token
|
|
68
94
|
|
|
69
95
|
1. Go to [Cloudflare API Tokens](https://dash.cloudflare.com/profile/api-tokens)
|
|
70
96
|
2. Click **Create Token** → **Use template** next to **Edit Cloudflare Workers**
|
|
@@ -84,7 +110,7 @@ Your permissions should include:
|
|
|
84
110
|
5. Set **Zone Resources** → **Include** → **All zones from an account** → your account
|
|
85
111
|
6. **Create Token** and copy it
|
|
86
112
|
|
|
87
|
-
|
|
113
|
+
### 3. Add GitHub Secrets
|
|
88
114
|
|
|
89
115
|
Go to your repo → **Settings** → **Secrets and variables** → **Actions**:
|
|
90
116
|
|
|
@@ -92,39 +118,43 @@ Go to your repo → **Settings** → **Secrets and variables** → **Actions**:
|
|
|
92
118
|
| --------------- | ------------------------------------------------------------------------ |
|
|
93
119
|
| `CF_API_TOKEN` | API token from above |
|
|
94
120
|
| `CF_ACCOUNT_ID` | Your Cloudflare Account ID (found in dashboard URL or `wrangler whoami`) |
|
|
95
|
-
| `AUTH_SECRET` | Random 32+ character string (`openssl rand -base64 32`) |
|
|
96
121
|
|
|
97
|
-
|
|
122
|
+
### 4. Enable Auto-Deploy
|
|
98
123
|
|
|
99
|
-
|
|
124
|
+
Uncomment the push trigger in `.github/workflows/deploy.yml`:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
on:
|
|
128
|
+
push:
|
|
129
|
+
branches:
|
|
130
|
+
- main
|
|
131
|
+
workflow_dispatch:
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Now every push to `main` will auto-deploy.
|
|
135
|
+
|
|
136
|
+
### Using Environments (Optional)
|
|
100
137
|
|
|
101
138
|
For separate staging/production, update `.github/workflows/deploy.yml`:
|
|
102
139
|
|
|
103
140
|
```yaml
|
|
104
141
|
jobs:
|
|
105
142
|
deploy:
|
|
106
|
-
uses: jant-me/jant/.github/workflows/deploy.yml@
|
|
143
|
+
uses: jant-me/jant/.github/workflows/deploy.yml@main
|
|
107
144
|
with:
|
|
108
145
|
environment: production # Uses [env.production] in wrangler.toml
|
|
109
146
|
secrets:
|
|
110
147
|
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
|
111
148
|
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
|
112
|
-
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
|
|
113
149
|
```
|
|
114
150
|
|
|
115
|
-
### 7. Custom Domain (Optional)
|
|
116
|
-
|
|
117
|
-
1. Go to [Cloudflare Dashboard](https://dash.cloudflare.com) → Workers & Pages
|
|
118
|
-
2. Select your worker → Settings → Triggers
|
|
119
|
-
3. Click **Add Custom Domain** and enter your domain
|
|
120
|
-
|
|
121
151
|
## Commands
|
|
122
152
|
|
|
123
153
|
| Command | Description |
|
|
124
154
|
| ------------------------ | ---------------------------------- |
|
|
125
155
|
| `pnpm dev` | Start development server |
|
|
126
156
|
| `pnpm build` | Build for production |
|
|
127
|
-
| `pnpm deploy`
|
|
157
|
+
| `pnpm run deploy` | Build and deploy to Cloudflare |
|
|
128
158
|
| `pnpm preview` | Preview production build |
|
|
129
159
|
| `pnpm typecheck` | Run TypeScript checks |
|
|
130
160
|
| `pnpm db:migrate:remote` | Apply database migrations (remote) |
|
|
@@ -205,8 +235,8 @@ export default createApp({
|
|
|
205
235
|
## Updating
|
|
206
236
|
|
|
207
237
|
```bash
|
|
208
|
-
# Update @jant/core
|
|
209
|
-
pnpm
|
|
238
|
+
# Update @jant/core to latest version
|
|
239
|
+
pnpm add @jant/core@latest
|
|
210
240
|
|
|
211
241
|
# Start dev server (auto-applies migrations locally)
|
|
212
242
|
pnpm dev
|
|
@@ -215,10 +245,12 @@ pnpm dev
|
|
|
215
245
|
pnpm db:migrate:remote
|
|
216
246
|
|
|
217
247
|
# Deploy
|
|
218
|
-
pnpm deploy
|
|
248
|
+
pnpm run deploy
|
|
219
249
|
```
|
|
220
250
|
|
|
221
251
|
> 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/jant-me/jant/releases) for any breaking changes.
|
|
252
|
+
>
|
|
253
|
+
> **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.
|
|
222
254
|
|
|
223
255
|
## Documentation
|
|
224
256
|
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
# Deploy to Cloudflare Workers
|
|
2
2
|
# Documentation: https://jant.me/docs/deployment
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
4
|
+
# Prerequisites:
|
|
5
|
+
# 1. Complete manual deployment first (see README.md → Deploy to Cloudflare)
|
|
6
|
+
# 2. Set GitHub secrets: CF_API_TOKEN and CF_ACCOUNT_ID
|
|
7
|
+
#
|
|
8
|
+
# Runtime secrets (AUTH_SECRET, S3 keys, etc.) are managed via
|
|
9
|
+
# `wrangler secret put` and persist across deployments.
|
|
8
10
|
|
|
9
11
|
name: Deploy
|
|
10
12
|
|
|
11
13
|
on:
|
|
12
|
-
push:
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
# Uncomment to auto-deploy on push after configuring secrets:
|
|
15
|
+
# push:
|
|
16
|
+
# branches:
|
|
17
|
+
# - main
|
|
15
18
|
workflow_dispatch:
|
|
16
19
|
|
|
17
20
|
jobs:
|
|
18
21
|
deploy:
|
|
19
|
-
uses: jant-me/jant/.github/workflows/deploy.yml@
|
|
22
|
+
uses: jant-me/jant/.github/workflows/deploy.yml@main
|
|
20
23
|
secrets:
|
|
21
24
|
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
|
22
25
|
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
|
23
|
-
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
|
|
@@ -82,7 +82,7 @@ cd my-blog
|
|
|
82
82
|
pnpm dev
|
|
83
83
|
|
|
84
84
|
# Deploy to Cloudflare
|
|
85
|
-
pnpm deploy
|
|
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 deploy
|
|
150
|
+
pnpm run deploy
|
|
151
151
|
</code></pre>
|
|
152
152
|
<h2>Documentation</h2>
|
|
153
153
|
<ul>
|