create-astroid 0.3.1 → 0.3.2
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/index.mjs +9 -3
- package/package.json +3 -3
- package/template/README.md +14 -0
- package/template/_github/workflows/ci.yml +54 -0
- package/template/package.json +2 -1
package/index.mjs
CHANGED
|
@@ -34,9 +34,15 @@ import {
|
|
|
34
34
|
|
|
35
35
|
const TEMPLATE_DIR = join(dirname(fileURLToPath(import.meta.url)), "template");
|
|
36
36
|
|
|
37
|
-
// Files whose leading `_` is stripped on copy (npm strips real
|
|
38
|
-
// published package, so they ship as `_gitignore` /
|
|
39
|
-
|
|
37
|
+
// Files (and dirs) whose leading `_` is stripped on copy (npm strips real
|
|
38
|
+
// dotfiles from a published package, so they ship as `_gitignore` /
|
|
39
|
+
// `_env.example` / `_github/…`). Applied per entry in `copyTemplate`, so a
|
|
40
|
+
// directory renames too — `_github` becomes `.github` and its contents follow.
|
|
41
|
+
const DOTFILE_RENAMES = {
|
|
42
|
+
_gitignore: ".gitignore",
|
|
43
|
+
"_env.example": ".env.example",
|
|
44
|
+
_github: ".github",
|
|
45
|
+
};
|
|
40
46
|
|
|
41
47
|
// Archetype → default editable home sections. Imported from astroidjs rather
|
|
42
48
|
// than duplicated here: as a literal in this file it could name a section that
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astroid",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Scaffold a new Astroid site — an editable, multi-editor Astro app on Cloudflare Workers — in one command.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@better-auth/passkey": "^1.6.23",
|
|
34
34
|
"better-auth": "^1.6.23",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"louise-toolkit": "0.18.0",
|
|
36
|
+
"astroidjs": "0.3.2"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=24.0.0"
|
package/template/README.md
CHANGED
|
@@ -103,6 +103,20 @@ pnpm doctor # validate config, bindings, and generated-file freshness
|
|
|
103
103
|
wrangler deploy # or: pnpm astroid deploy
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
## Taking payments
|
|
107
|
+
|
|
108
|
+
Storefront sites (`--commerce square`) are scaffolded with a server-authoritative
|
|
109
|
+
payment route at `src/pages/api/checkout.ts` and a `<SquareCard>` input. **Keep
|
|
110
|
+
its sequence** — extend it (shipping, tax, an order row, a receipt), don't replace
|
|
111
|
+
it. It re-prices every line from the D1 catalog mirror (the client's price is a
|
|
112
|
+
_staleness check_, never an input to the charge — accept a `unitPrice` from the
|
|
113
|
+
request body and anyone buys anything for a penny) and derives the Square
|
|
114
|
+
idempotency key from the verified cart **and** the cart id. Hand-rolling
|
|
115
|
+
`createPayment` without a stable, cart-scoped idempotency key is the failure this
|
|
116
|
+
route exists to prevent: a double-clicked Pay button charges twice, and a
|
|
117
|
+
constant (or omitted) key lets two customers' identical carts collide into a
|
|
118
|
+
single charge.
|
|
119
|
+
|
|
106
120
|
## Layout
|
|
107
121
|
|
|
108
122
|
| Path | What |
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
# Cancel superseded runs on the same ref (a force-push mid-run).
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ci-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
env:
|
|
17
|
+
# corepack pins pnpm from `packageManager` in package.json; in CI it must
|
|
18
|
+
# fetch that version without an interactive prompt.
|
|
19
|
+
COREPACK_ENABLE_DOWNLOAD_PROMPT: 0
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: 24
|
|
26
|
+
|
|
27
|
+
# pnpm via corepack, pinned by `packageManager` — the same version you
|
|
28
|
+
# develop with, so `--frozen-lockfile` below always matches the committed
|
|
29
|
+
# pnpm-lock.yaml. (Commit that lockfile; this step relies on it.)
|
|
30
|
+
- name: Enable pnpm (corepack)
|
|
31
|
+
run: corepack enable
|
|
32
|
+
|
|
33
|
+
- name: Install
|
|
34
|
+
run: pnpm install --frozen-lockfile
|
|
35
|
+
|
|
36
|
+
# Validate the config, bindings, and that the generated
|
|
37
|
+
# src/schema.ts · src/worker.ts · src/middleware.ts trio is still in sync
|
|
38
|
+
# with astroid.config.ts. A fast fail before the heavier steps.
|
|
39
|
+
- name: Doctor
|
|
40
|
+
run: pnpm doctor
|
|
41
|
+
|
|
42
|
+
# No-ops on a fresh scaffold; runs automatically once you add a `lint`
|
|
43
|
+
# script (oxlint/biome) — same for `test` (vitest) further down.
|
|
44
|
+
- name: Lint
|
|
45
|
+
run: pnpm run --if-present lint
|
|
46
|
+
|
|
47
|
+
- name: Type-check
|
|
48
|
+
run: pnpm check
|
|
49
|
+
|
|
50
|
+
- name: Test
|
|
51
|
+
run: pnpm run --if-present test
|
|
52
|
+
|
|
53
|
+
- name: Build
|
|
54
|
+
run: pnpm build
|