create-jant 0.3.39 → 0.3.40

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
@@ -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.39";
12
+ var CORE_VERSION = "0.3.40";
13
13
  var WRANGLER_VERSION = "^4.76.0";
14
14
  var TEMPLATE_DIR = fs.existsSync(path.resolve(__dirname, "../template")) ? path.resolve(__dirname, "../template") : path.resolve(__dirname, "../../../sites/demo");
15
15
  function isValidProjectName(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-jant",
3
- "version": "0.3.39",
3
+ "version": "0.3.40",
4
4
  "description": "Create a new Jant project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -121,6 +121,8 @@ Your site is now live at `https://<your-project>.<your-subdomain>.workers.dev`!
121
121
  A workflow file is included at `.github/workflows/deploy.yml`. Complete the [deployment](#deploy-to-cloudflare) first, then set up CI for automatic deployments.
122
122
 
123
123
  > Runtime secrets (`AUTH_SECRET`, S3 keys, etc.) are already stored in Cloudflare from the manual deployment step. CI only needs deployment credentials.
124
+ >
125
+ > Until you replace the placeholder D1 `database_id` in `wrangler.toml` and add `CF_API_TOKEN` and `CF_ACCOUNT_ID`, the workflow exits early with a skip message instead of failing.
124
126
 
125
127
  #### 1. Push to GitHub
126
128
 
@@ -34,13 +34,47 @@ jobs:
34
34
  - name: Install dependencies
35
35
  run: npm ci
36
36
 
37
+ - name: Check deploy prerequisites
38
+ id: preflight
39
+ env:
40
+ CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
41
+ CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
42
+ run: |
43
+ set -eu
44
+
45
+ if [ -z "${CF_API_TOKEN}" ] || [ -z "${CF_ACCOUNT_ID}" ]; then
46
+ echo "ready=false" >> "$GITHUB_OUTPUT"
47
+ {
48
+ echo "### Deploy skipped"
49
+ echo
50
+ echo "Add \`CF_API_TOKEN\` and \`CF_ACCOUNT_ID\` in GitHub Actions secrets to enable auto-deploy."
51
+ } >> "$GITHUB_STEP_SUMMARY"
52
+ exit 0
53
+ fi
54
+
55
+ database_id="$(sed -n 's/^database_id = "\\([^"]*\\)".*/\\1/p' wrangler.toml | head -n 1)"
56
+
57
+ if [ -z "${database_id}" ] || [ "${database_id}" = "local" ]; then
58
+ echo "ready=false" >> "$GITHUB_OUTPUT"
59
+ {
60
+ echo "### Deploy skipped"
61
+ echo
62
+ echo "Replace the placeholder D1 \`database_id\` in \`wrangler.toml\` before enabling auto-deploy."
63
+ } >> "$GITHUB_STEP_SUMMARY"
64
+ exit 0
65
+ fi
66
+
67
+ echo "ready=true" >> "$GITHUB_OUTPUT"
68
+
37
69
  - name: Run migrations
70
+ if: steps.preflight.outputs.ready == 'true'
38
71
  run: npx wrangler d1 migrations apply DB --remote
39
72
  env:
40
73
  CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
41
74
  CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
42
75
 
43
76
  - name: Deploy to Cloudflare Workers
77
+ if: steps.preflight.outputs.ready == 'true'
44
78
  uses: cloudflare/wrangler-action@v3
45
79
  with:
46
80
  apiToken: ${{ secrets.CF_API_TOKEN }}
@@ -24,7 +24,7 @@ port = 3000
24
24
  [vars]
25
25
  # Optional: Pin your site's public origin (e.g. https://my-blog.example.com)
26
26
  # https://github.com/jant-me/jant/blob/main/docs/configuration.md#public-urls-and-subpaths
27
- SITE_ORIGIN = "https://demo.jant.me" # @create-jant: "https://example.com"
27
+ # SITE_ORIGIN = "https://demo.jant.me"
28
28
  # Optional: Mount the site under a subpath such as /blog
29
29
  # SITE_PATH_PREFIX = "/blog"
30
30