create-astroid 0.3.17 → 0.5.0
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 +23 -7
- package/package.json +8 -7
- package/template/README.md +17 -0
- package/template/docs/ARCHITECTURE.md +55 -0
- package/template/docs/DECISIONS.md +46 -0
- package/template/docs/RUNBOOK.md +96 -0
- package/template/package.json +1 -0
package/index.mjs
CHANGED
|
@@ -94,21 +94,37 @@ const slugify = (s) =>
|
|
|
94
94
|
* config. CI could not see it — the clean-room smoke test pins both packages to
|
|
95
95
|
* tarballs via pnpm `overrides`, which is exactly what erases these ranges.
|
|
96
96
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
97
|
+
* Three shapes reach the `declared` value, and all three have to end up as one
|
|
98
|
+
* caret range:
|
|
99
|
+
*
|
|
100
|
+
* - `workspace:*` — a sibling in this repo (`astroidjs`). Falls back to the
|
|
101
|
+
* version of the copy actually resolved on disk, which is what the scaffold
|
|
102
|
+
* would install anyway. `pnpm pack` rewrites these to a concrete version, so
|
|
103
|
+
* a PUBLISHED create-astroid never carries one.
|
|
104
|
+
* - an exact version — what `pnpm pack` leaves behind for a former
|
|
105
|
+
* `workspace:*`.
|
|
106
|
+
* - an already-caretted range — what an external dependency is written as now
|
|
107
|
+
* that `louise-toolkit` and `@louise-toolkit/astro` live in another repo.
|
|
108
|
+
*
|
|
109
|
+
* That last one is why `stripRange` exists. Prefixing `^` onto `^0.27.0` yields
|
|
110
|
+
* `^^0.27.0`, which npm rejects as invalid, and every scaffolded project would
|
|
111
|
+
* fail at `pnpm install` before anything type-checked. It cost nothing to guard
|
|
112
|
+
* and would have been invisible until the first scaffold after the repo split.
|
|
102
113
|
*
|
|
103
114
|
* Caret on a 0.x is minor-locked (`^0.2.0` := `>=0.2.0 <0.3.0`), which is the
|
|
104
115
|
* behaviour we want while the toolkit is pre-1.0 and marks breaking changes as
|
|
105
116
|
* minors: patches flow, a breaking minor does not.
|
|
106
117
|
*/
|
|
118
|
+
/** `^1.2.3` / `~1.2.3` / `>=1.2.3` → `1.2.3`. See {@link toolkitRanges}. */
|
|
119
|
+
function stripRange(version) {
|
|
120
|
+
return String(version).replace(/^[\^~]|^>=\s*/, "");
|
|
121
|
+
}
|
|
122
|
+
|
|
107
123
|
function toolkitRanges() {
|
|
108
124
|
const req = createRequire(import.meta.url);
|
|
109
125
|
const self = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8"));
|
|
110
126
|
const ranges = {};
|
|
111
|
-
for (const name of ["astroidjs", "louise-toolkit"]) {
|
|
127
|
+
for (const name of ["astroidjs", "louise-toolkit", "@louise-toolkit/astro"]) {
|
|
112
128
|
const declared = self.dependencies?.[name];
|
|
113
129
|
let version = declared && !declared.startsWith("workspace:") ? declared : undefined;
|
|
114
130
|
if (!version) {
|
|
@@ -121,7 +137,7 @@ function toolkitRanges() {
|
|
|
121
137
|
"This is a packaging fault — please file an issue rather than editing the scaffold by hand.",
|
|
122
138
|
);
|
|
123
139
|
}
|
|
124
|
-
ranges[name] = `^${version}`;
|
|
140
|
+
ranges[name] = `^${stripRange(version)}`;
|
|
125
141
|
}
|
|
126
142
|
return ranges;
|
|
127
143
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astroid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"author": "BowenLabs",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/bowenlabs/
|
|
18
|
+
"url": "git+https://github.com/bowenlabs/astroidjs.git",
|
|
19
19
|
"directory": "packages/create-astroid"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
@@ -30,12 +30,13 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@better-auth/passkey": "^1.
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
33
|
+
"@better-auth/passkey": "^1.7.2",
|
|
34
|
+
"@louise-toolkit/astro": "^0.1.1",
|
|
35
|
+
"better-auth": "^1.7.2",
|
|
36
|
+
"louise-toolkit": "^0.28.0",
|
|
37
|
+
"astroidjs": "0.10.0"
|
|
37
38
|
},
|
|
38
39
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
40
|
+
"node": ">=26.0.0"
|
|
40
41
|
}
|
|
41
42
|
}
|
package/template/README.md
CHANGED
|
@@ -128,3 +128,20 @@ single charge.
|
|
|
128
128
|
| `src/pages/` · `src/components/` · `src/layouts/` | Your Astro app. |
|
|
129
129
|
| `migrations/` | `0000_content.sql` (content + FTS) · `0001_auth.sql` (Better Auth). |
|
|
130
130
|
| `scripts/seed-editors.mjs` | Bootstrap the first editor. |
|
|
131
|
+
| `docs/` | ARCHITECTURE · RUNBOOK · DECISIONS — stubs to fill in as you go. |
|
|
132
|
+
|
|
133
|
+
## The docs/ trio
|
|
134
|
+
|
|
135
|
+
Three near-empty documents, scaffolded on purpose. Three production Astroid sites
|
|
136
|
+
each wrote the same three without coordinating, and converged on the same
|
|
137
|
+
headings — so you inherit the questions rather than a blank directory.
|
|
138
|
+
|
|
139
|
+
| | What goes in it |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| `docs/ARCHITECTURE.md` | How this site is put together — request flow, content model, bindings. |
|
|
142
|
+
| `docs/RUNBOOK.md` | Operating it — local dev, migrations, secrets, deploy, and **common breakages**. |
|
|
143
|
+
| `docs/DECISIONS.md` | Choices the framework leaves open, and why you made yours. |
|
|
144
|
+
|
|
145
|
+
`DECISIONS.md` ships with a list of the questions every Astroid site has to
|
|
146
|
+
answer — editors, rich-text storage, sections, commerce, migrations, CSP, edge
|
|
147
|
+
caching. Delete each one as it becomes a real entry.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
How __BRAND_NAME__ is put together: what happens to a request, where content
|
|
4
|
+
lives, and which pieces are the framework's rather than yours.
|
|
5
|
+
|
|
6
|
+
> Scaffolded by `create-astroid`. Describe what is TRUE of this site, not what
|
|
7
|
+
> Astroid does in general — that is documented at
|
|
8
|
+
> <https://docs.astroidjs.org>. The useful content here is the part that would
|
|
9
|
+
> surprise someone who knows the framework.
|
|
10
|
+
|
|
11
|
+
## Request flow
|
|
12
|
+
|
|
13
|
+
One Worker serves everything: pages, the editor API, and static assets.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
request → middleware (session, edit mode, rate limits)
|
|
17
|
+
→ Astro route
|
|
18
|
+
→ Louise primitives (content, media, forms) over D1 / R2 / KV
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
<!-- Anything site-specific in the path: extra middleware, a host check, a
|
|
22
|
+
redirect layer, routes that bypass the editor entirely. -->
|
|
23
|
+
|
|
24
|
+
## Content model
|
|
25
|
+
|
|
26
|
+
<!-- The collections this site defines and what each one is for. Note which
|
|
27
|
+
fields are rich text, which are structured, and anything a section depends
|
|
28
|
+
on being present. The schema is generated from astroid.config.ts — link to
|
|
29
|
+
it rather than restating it, and record the REASONING here. -->
|
|
30
|
+
|
|
31
|
+
## Editing
|
|
32
|
+
|
|
33
|
+
<!-- Which parts of a page are editable and how they are marked. Sections vs
|
|
34
|
+
inline fields vs settings. If a section is deliberately not editable, that
|
|
35
|
+
is worth a line — the next person will assume it was an oversight. -->
|
|
36
|
+
|
|
37
|
+
## Auth
|
|
38
|
+
|
|
39
|
+
<!-- Editors, and customers if this site has them. Astroid ships DB-managed
|
|
40
|
+
editors on one Better Auth instance. If you split it, added a portal, or
|
|
41
|
+
changed the allowlist model, describe it here and record WHY in
|
|
42
|
+
DECISIONS.md. -->
|
|
43
|
+
|
|
44
|
+
## Bindings
|
|
45
|
+
|
|
46
|
+
<!-- The bindings in wrangler.jsonc and what each is actually used for. A
|
|
47
|
+
binding whose purpose is not written down is a binding nobody dares remove.
|
|
48
|
+
|
|
49
|
+
D1, R2, KV (RL / DRAFTS), and whatever the enabled modules added. -->
|
|
50
|
+
|
|
51
|
+
## Rendering
|
|
52
|
+
|
|
53
|
+
<!-- Layouts, the section library, and where site-owned components live. Which
|
|
54
|
+
styling approach, and any deliberate constraint (no client JS on these
|
|
55
|
+
routes, CSP rules that shape what a section may do). -->
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Decisions
|
|
2
|
+
|
|
3
|
+
Choices __BRAND_NAME__ made that the framework deliberately leaves open, and why.
|
|
4
|
+
|
|
5
|
+
> Scaffolded by `create-astroid`. This is the document that ages best, because a
|
|
6
|
+
> decision's *reasoning* is the part nobody can reconstruct later. Record the
|
|
7
|
+
> choice when you make it, while the alternatives are still fresh.
|
|
8
|
+
>
|
|
9
|
+
> Not an ADR log — no status field, no numbering ceremony. One heading per
|
|
10
|
+
> decision, newest at the top, and a line about what you did instead.
|
|
11
|
+
|
|
12
|
+
## Template
|
|
13
|
+
|
|
14
|
+
```md
|
|
15
|
+
## <the decision, as a statement>
|
|
16
|
+
|
|
17
|
+
<What was chosen, in one or two sentences.>
|
|
18
|
+
|
|
19
|
+
**Why.** The reason that actually drove it — the constraint, the incident, the
|
|
20
|
+
thing that would have gone wrong otherwise.
|
|
21
|
+
|
|
22
|
+
**Instead of.** The alternative that was genuinely considered, and what it would
|
|
23
|
+
have cost. If there wasn't one, say so; "no real alternative" is a finding.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Questions this site will have to answer
|
|
27
|
+
|
|
28
|
+
Delete each one as it becomes a real entry above. Every Astroid site meets these,
|
|
29
|
+
and the framework takes no position on any of them:
|
|
30
|
+
|
|
31
|
+
- **Editors** — DB-managed rows, or an environment allowlist? One auth instance
|
|
32
|
+
or two, if customers sign in as well?
|
|
33
|
+
- **Rich text storage** — HTML or document JSON? This is very hard to change
|
|
34
|
+
later; the sites that picked HTML did it for portability and said so.
|
|
35
|
+
- **Sections** — the shipped library as-is, fixed slots, or bespoke sections
|
|
36
|
+
injected into the catalog?
|
|
37
|
+
- **Commerce** — none, or which provider? If there is a catalog: live reads, or a
|
|
38
|
+
D1 mirror? Where money is calculated, and what makes that server-authoritative.
|
|
39
|
+
- **Migrations** — hand-authored SQL is the default. If you adopt a generator,
|
|
40
|
+
write down what happens to the existing hand-authored files.
|
|
41
|
+
- **Content security policy** — generated, or hand-maintained in
|
|
42
|
+
`astro.config.mjs`? A section that needs an inline style forces this question.
|
|
43
|
+
- **Edge caching** — off by default. Turning it on has a revalidation story that
|
|
44
|
+
belongs here, not in a commit message.
|
|
45
|
+
- **Service worker / PWA** — a manifest is cheap; a service worker is a cache
|
|
46
|
+
invalidation problem you now own.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Runbook
|
|
2
|
+
|
|
3
|
+
Operating __BRAND_NAME__: local dev, migrations, secrets, deploy, and what to do
|
|
4
|
+
when something breaks.
|
|
5
|
+
|
|
6
|
+
> Scaffolded by `create-astroid`. The headings are the ones three production
|
|
7
|
+
> Astroid sites arrived at independently — fill them in as you go. A heading with
|
|
8
|
+
> nothing under it is a question you have not had to answer yet, which is useful
|
|
9
|
+
> information on its own.
|
|
10
|
+
|
|
11
|
+
## Local development
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm install
|
|
15
|
+
pnpm dev # astroid dev — regenerates, then astro dev on workerd
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The site renders from seed content with no configuration. To exercise the editor
|
|
19
|
+
locally, apply migrations and seed yourself as an editor:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
pnpm exec wrangler d1 migrations apply DB --local
|
|
23
|
+
OWNER_EMAIL=you@example.com pnpm seed:editors
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then open `/louise` and request the magic link — in local dev it is **printed to
|
|
27
|
+
the dev console**, since there is no email binding. Follow it to `/?louise` for
|
|
28
|
+
edit mode.
|
|
29
|
+
|
|
30
|
+
## Provisioning (first deploy)
|
|
31
|
+
|
|
32
|
+
Create the resources, then paste the ids into `wrangler.jsonc`:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
wrangler d1 create __KEY__
|
|
36
|
+
wrangler r2 bucket create __KEY__-media
|
|
37
|
+
wrangler kv namespace create RL
|
|
38
|
+
wrangler kv namespace create DRAFTS
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
<!-- Record anything that was NOT obvious: custom domains, DNS, account ids when
|
|
42
|
+
more than one Cloudflare account is in play. -->
|
|
43
|
+
|
|
44
|
+
## Deploy
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
pnpm doctor # validate config, bindings, and the generated files
|
|
48
|
+
wrangler deploy
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
<!-- Who deploys, from where, and what gates it? If deploys are automatic on push
|
|
52
|
+
to main, say so here — that is the first thing a new person asks. -->
|
|
53
|
+
|
|
54
|
+
## D1 migrations
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
wrangler d1 migrations apply DB --remote
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
<!-- Migrations are hand-authored SQL under migrations/. Note the ordering rules
|
|
61
|
+
you adopt, and anything that must be applied before a deploy rather than
|
|
62
|
+
after. -->
|
|
63
|
+
|
|
64
|
+
## Seeding content
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
wrangler d1 execute DB --remote --file seed/home.seed.sql
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
<!-- What is seeded, what is authored in the editor, and which is authoritative
|
|
71
|
+
when they disagree. -->
|
|
72
|
+
|
|
73
|
+
## Secrets
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
wrangler secret put SESSION_SECRET
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
<!-- Where each secret lives (wrangler secret, Secrets Store, a var in
|
|
80
|
+
wrangler.jsonc) and who can rotate it. Never the values themselves. -->
|
|
81
|
+
|
|
82
|
+
## Editing the live site
|
|
83
|
+
|
|
84
|
+
<!-- Who the editors are and how they are added. Astroid ships DB-managed editors
|
|
85
|
+
by default — `pnpm seed:editors` writes the first one — rather than an env
|
|
86
|
+
allowlist. If you changed that, this is where it is written down. -->
|
|
87
|
+
|
|
88
|
+
## Common breakages
|
|
89
|
+
|
|
90
|
+
<!-- The section that pays for the whole document. Add an entry every time
|
|
91
|
+
something surprises you, with the symptom FIRST — that is what someone
|
|
92
|
+
searches for at the time.
|
|
93
|
+
|
|
94
|
+
Format that works:
|
|
95
|
+
**Symptom.** What you actually saw.
|
|
96
|
+
Cause, and the fix. -->
|
package/template/package.json
CHANGED