create-jant 0.3.19 → 0.3.20
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 +1 -1
- package/package.json +1 -1
- package/template/README.md +18 -26
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.20";
|
|
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);
|
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
A personal website/blog powered by [Jant](https://github.com/jant-me/jant).
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
### Option A: One-Click Deploy
|
|
5
|
+
## Option A: One-Click Deploy
|
|
8
6
|
|
|
9
7
|
Deploy to Cloudflare instantly — no local setup required:
|
|
10
8
|
|
|
11
9
|
[](https://deploy.workers.cloudflare.com/?url=https://github.com/jant-me/jant-starter)
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
### Deploy form fields
|
|
14
12
|
|
|
15
13
|
| Field | What to do |
|
|
16
14
|
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -21,14 +19,14 @@ Deploy to Cloudflare instantly — no local setup required:
|
|
|
21
19
|
| **AUTH_SECRET** | Used for login session encryption. Keep the pre-filled value or generate your own with `openssl rand -base64 32`. |
|
|
22
20
|
| **SITE_URL** | Change this to your production URL (e.g. `https://my-blog.example.com`). If you don't have a custom domain yet, leave it empty — you can set it later in the Cloudflare dashboard after you know your `*.workers.dev` URL. |
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
### After deploy
|
|
25
23
|
|
|
26
24
|
1. Visit your site at the URL shown in the Cloudflare dashboard (e.g. `https://<project>.<account>.workers.dev`)
|
|
27
25
|
2. Go to `/dash` to set up your admin account
|
|
28
26
|
3. If you set `SITE_URL` to a custom domain, add it in: Cloudflare dashboard → Workers & Pages → your worker → Settings → Domains & Routes → Add Custom Domain
|
|
29
27
|
4. If you left `SITE_URL` empty, set it to your `*.workers.dev` URL: Cloudflare dashboard → Workers & Pages → your worker → Settings → Variables and Secrets
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
### Develop locally
|
|
32
30
|
|
|
33
31
|
```bash
|
|
34
32
|
# Clone the repo that was created for you
|
|
@@ -40,9 +38,7 @@ npm run dev
|
|
|
40
38
|
|
|
41
39
|
Visit http://localhost:9019. Changes pushed to `main` will auto-deploy.
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### Option B: Create with CLI
|
|
41
|
+
## Option B: Create with CLI
|
|
46
42
|
|
|
47
43
|
Set up a new project locally, then deploy manually:
|
|
48
44
|
|
|
@@ -54,11 +50,9 @@ npm run dev
|
|
|
54
50
|
|
|
55
51
|
Visit http://localhost:9019. When you're ready to go live, continue with [Deploy to Cloudflare](#deploy-to-cloudflare) below.
|
|
56
52
|
|
|
57
|
-
|
|
53
|
+
### Deploy to Cloudflare
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### 1. Prerequisites
|
|
55
|
+
#### 1. Prerequisites
|
|
62
56
|
|
|
63
57
|
Install [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/) and log in:
|
|
64
58
|
|
|
@@ -66,7 +60,7 @@ Install [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/instal
|
|
|
66
60
|
wrangler login
|
|
67
61
|
```
|
|
68
62
|
|
|
69
|
-
|
|
63
|
+
#### 2. Create D1 Database
|
|
70
64
|
|
|
71
65
|
Check the `database_name` in your `wrangler.toml` (defaults to `<your-project>-db`), then create it:
|
|
72
66
|
|
|
@@ -75,7 +69,7 @@ wrangler d1 create <your-project>-db
|
|
|
75
69
|
# Copy the database_id from the output!
|
|
76
70
|
```
|
|
77
71
|
|
|
78
|
-
|
|
72
|
+
#### 3. Update Configuration
|
|
79
73
|
|
|
80
74
|
Edit `wrangler.toml`:
|
|
81
75
|
|
|
@@ -86,7 +80,7 @@ Edit `wrangler.toml`:
|
|
|
86
80
|
>
|
|
87
81
|
> **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.
|
|
88
82
|
|
|
89
|
-
|
|
83
|
+
#### 4. Set Production Secrets
|
|
90
84
|
|
|
91
85
|
Generate a production secret and save it somewhere safe (you'll need it again for CI):
|
|
92
86
|
|
|
@@ -101,7 +95,7 @@ wrangler secret put AUTH_SECRET
|
|
|
101
95
|
|
|
102
96
|
> **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 `npm run reset-password` to generate a password reset link.
|
|
103
97
|
|
|
104
|
-
|
|
98
|
+
#### 5. Deploy
|
|
105
99
|
|
|
106
100
|
```bash
|
|
107
101
|
# Apply database migrations and deploy
|
|
@@ -110,21 +104,19 @@ npm run deploy
|
|
|
110
104
|
|
|
111
105
|
Your site is now live at `https://<your-project>.<your-subdomain>.workers.dev`!
|
|
112
106
|
|
|
113
|
-
|
|
107
|
+
#### 6. Custom Domain (Optional)
|
|
114
108
|
|
|
115
109
|
1. Go to [Cloudflare Dashboard](https://dash.cloudflare.com) → Workers & Pages
|
|
116
110
|
2. Select your worker → Settings → Domains & Routes
|
|
117
111
|
3. Click **Add -> Custom domain** and enter your domain
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
> This section is for **CLI-created projects** (Option B). One-click deploy users already have CI/CD configured.
|
|
113
|
+
### GitHub Actions (CI/CD)
|
|
122
114
|
|
|
123
115
|
A workflow file is included at `.github/workflows/deploy.yml`. Complete the [deployment](#deploy-to-cloudflare) first, then set up CI for automatic deployments.
|
|
124
116
|
|
|
125
117
|
> Runtime secrets (`AUTH_SECRET`, S3 keys, etc.) are already stored in Cloudflare from the manual deployment step. CI only needs deployment credentials.
|
|
126
118
|
|
|
127
|
-
|
|
119
|
+
#### 1. Push to GitHub
|
|
128
120
|
|
|
129
121
|
Create a new repository on [GitHub](https://github.com/new), then commit and push your project:
|
|
130
122
|
|
|
@@ -135,7 +127,7 @@ git remote add origin git@github.com:<your-username>/<your-repo>.git
|
|
|
135
127
|
git push -u origin main
|
|
136
128
|
```
|
|
137
129
|
|
|
138
|
-
|
|
130
|
+
#### 2. Create API Token
|
|
139
131
|
|
|
140
132
|
1. Go to [Cloudflare API Tokens](https://dash.cloudflare.com/profile/api-tokens)
|
|
141
133
|
2. Click **Create Token** → **Use template** next to **Edit Cloudflare Workers**
|
|
@@ -155,7 +147,7 @@ Your permissions should include:
|
|
|
155
147
|
5. Set **Zone Resources** → **Include** → **All zones from an account** → your account
|
|
156
148
|
6. **Create Token** and copy it
|
|
157
149
|
|
|
158
|
-
|
|
150
|
+
#### 3. Add GitHub Secrets
|
|
159
151
|
|
|
160
152
|
Go to your repo → **Settings** → **Secrets and variables** → **Actions**:
|
|
161
153
|
|
|
@@ -164,7 +156,7 @@ Go to your repo → **Settings** → **Secrets and variables** → **Actions**:
|
|
|
164
156
|
| `CF_API_TOKEN` | API token from above |
|
|
165
157
|
| `CF_ACCOUNT_ID` | Your Cloudflare Account ID (found in dashboard URL or `wrangler whoami`) |
|
|
166
158
|
|
|
167
|
-
|
|
159
|
+
#### 4. Enable Auto-Deploy
|
|
168
160
|
|
|
169
161
|
Uncomment the push trigger in `.github/workflows/deploy.yml`:
|
|
170
162
|
|
|
@@ -178,7 +170,7 @@ on:
|
|
|
178
170
|
|
|
179
171
|
Now every push to `main` will auto-deploy.
|
|
180
172
|
|
|
181
|
-
|
|
173
|
+
#### Using Environments (Optional)
|
|
182
174
|
|
|
183
175
|
For separate staging/production, update `.github/workflows/deploy.yml`:
|
|
184
176
|
|