create-shibumi 0.3.4 → 0.4.1

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.
Files changed (43) hide show
  1. package/README.md +20 -4
  2. package/package.json +6 -5
  3. package/scripts/shibumi.lock.json +2 -2
  4. package/scripts/ship.lock.json +3 -3
  5. package/src/args.ts +3 -3
  6. package/src/cli.ts +3 -3
  7. package/src/create.ts +9 -0
  8. package/src/templates/blog/README.md +4 -3
  9. package/src/templates/blog/agents.md +22 -11
  10. package/src/templates/blog/bun.lock +7 -756
  11. package/src/templates/blog/gitignore +1 -2
  12. package/src/templates/blog/package.json +9 -11
  13. package/src/templates/blog/scripts/build.ts +48 -0
  14. package/src/templates/blog/scripts/preview.ts +42 -0
  15. package/src/templates/blog/serve.ts +11 -0
  16. package/src/templates/blog/src/app.ts +418 -0
  17. package/src/templates/blog/src/layout.html +25 -0
  18. package/src/templates/blog/src/pages/404.html +6 -0
  19. package/src/templates/blog/src/pages/index.html +11 -0
  20. package/src/templates/blog/src/pages/post.html +15 -0
  21. package/src/templates/blog/src/site.ts +7 -2
  22. package/src/templates/blog/tsconfig.json +18 -4
  23. package/src/templates/full-stack/Dockerfile +1 -1
  24. package/src/templates/full-stack/agents.md +2 -2
  25. package/src/templates/full-stack/bun.lock +1 -4
  26. package/src/templates/full-stack/compose.yaml +5 -2
  27. package/src/templates/full-stack/package.json +2 -3
  28. package/src/templates/full-stack/src/env.ts +1 -1
  29. package/src/templates/shibumi.ts +1 -1
  30. package/src/templates/ship.ts +50 -15
  31. package/src/templates/static/package.json +1 -1
  32. package/src/templates/static/scripts/preview.ts +1 -1
  33. package/src/templates/blog/astro.config.mjs +0 -13
  34. package/src/templates/blog/src/components/BaseHead.astro +0 -41
  35. package/src/templates/blog/src/content.config.ts +0 -20
  36. package/src/templates/blog/src/layouts/Base.astro +0 -37
  37. package/src/templates/blog/src/pages/404.astro +0 -11
  38. package/src/templates/blog/src/pages/index.astro +0 -33
  39. package/src/templates/blog/src/pages/llms.txt.ts +0 -29
  40. package/src/templates/blog/src/pages/posts/[id].astro +0 -32
  41. package/src/templates/blog/src/pages/posts/[id].md.ts +0 -18
  42. package/src/templates/blog/src/pages/robots.txt.ts +0 -6
  43. package/src/templates/blog/src/pages/rss.xml.ts +0 -21
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # create-shibumi
2
2
 
3
- Scaffold a Shibumi Stack project: simple apps, whole stack, without React, build pipelines, or 600 MB of `node_modules`. Every generated project keeps its source, tests, and deployment config in your repository. No Shibumi runtime dependency.
3
+ Scaffold a Bun full-stack app, blog, or static site as source you own. The full-stack template includes tests and container files; blog and static generate container files during deployment setup. No Shibumi runtime dependency.
4
+
5
+ Requires **Bun 1.4.4 or newer** and Git. Run `bun --version` to check, or `bun upgrade` to update. The CLI refuses an older runtime before creating project files.
4
6
 
5
7
  ```sh
6
8
  bun create shibumi@latest my-app
@@ -8,6 +10,8 @@ cd my-app
8
10
  bun dev
9
11
  ```
10
12
 
13
+ Choose **Later** for deployment, then open http://localhost:9001. In the full-stack starter, click Count and reload; SQLite keeps the value. Docker and a VPS are only needed when you deploy. [Follow the quick start](https://shibumistack.dev/docs) for the complete local and deployment path.
14
+
11
15
  Already have a project? Run it inside that project instead, and it gets deploy tooling rather than a scaffold:
12
16
 
13
17
  ```sh
@@ -17,7 +21,7 @@ bun create shibumi@latest .
17
21
  ## Three starting points
18
22
 
19
23
  1. **Bun full-stack app**: Hono, HTML, CSS, Alpine, Zod, tests, a health endpoint, and SQLite through Drizzle with migrations, persistent data, backup, and restore.
20
- 2. **Blog**: Astro with posts, RSS, sitemap, SEO meta, and llms.txt.
24
+ 2. **Blog**: the shibumistack.dev engine — a Bun + Hono markdown renderer with posts, RSS, sitemap, SEO meta, and llms.txt.
21
25
  3. **Static site**: publish a verified build directory such as `./dist`, `public`, `build`, or `out` from any framework.
22
26
 
23
27
  All three deploy to a Linux VPS or homelab through [shibumi-server](https://server.shibumistack.dev). Other providers can wait until their generated projects pass the same artifact and deployment tests.
@@ -50,11 +54,23 @@ Generated projects include a root `agents.md`. It records route locations, data
50
54
 
51
55
  ```sh
52
56
  bun install
53
- bun test # CLI tests (parsing, atomicity, signals, E2E)
54
- bun check # TypeScript
57
+ bun test # Local CLI and regression tests; never deploys to a VPS
58
+ bun check # Native type checking; no standalone TypeScript dependency
55
59
  bun sync:ship # re-vendor the Ship client from its locked immutable snapshot
56
60
  ```
57
61
 
58
62
  The vendored Ship client in `src/templates/ship.ts` is locked byte-for-byte to a published immutable snapshot via `scripts/ship.lock.json`; tests fail on any drift.
59
63
 
64
+ ## Live deployment tests
65
+
66
+ The opt-in E2E suite uses Bun to pack and install the CLI outside this checkout. It runs the generated Ship client against a disposable VPS registration, checks real HTTPS pages in a browser, redeploys changed content, verifies recovery from an unhealthy image, and rolls back to the expected commit.
67
+
68
+ ```sh
69
+ SHIBUMI_E2E=1 bun run test:e2e:matrix /absolute/path/to/target.json
70
+ ```
71
+
72
+ The matrix covers every template in `src/args.ts` twice. Full-stack checks include auth and uploads, session cookies, and persistent SQLite data and file bytes. Blog checks include posts, drafts, canonical/OG metadata, feeds and Markdown alternates. Static checks include nested pages, assets, MIME types and custom 404s. Results and screenshots stay outside the checkout.
73
+
74
+ This changes a dedicated test app and private test repository. Read [the setup and safety instructions](scripts/e2e.md) before running it. The matrix restores and deploys the original full-stack fixture afterward. Normal `bun test` does not run these live checks.
75
+
60
76
  Docs: <https://shibumistack.dev/docs>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-shibumi",
3
- "version": "0.3.4",
3
+ "version": "0.4.1",
4
4
  "description": "Scaffold a Shibumi Stack project: Bun, Hono, Zod, Drizzle, SQLite, Alpine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,7 +24,9 @@
24
24
  "scripts": {
25
25
  "start": "bun src/cli.ts",
26
26
  "test": "bun test test",
27
- "check": "tsc --noEmit",
27
+ "test:e2e": "bun scripts/e2e.ts",
28
+ "test:e2e:matrix": "bun scripts/e2e-matrix.ts",
29
+ "check": "bun check --no-script",
28
30
  "sync:ship": "bun scripts/sync-ship.ts",
29
31
  "sync:extensions": "bun scripts/sync-extensions.ts",
30
32
  "verify:packed": "bun scripts/verify-packed.ts",
@@ -53,10 +55,9 @@
53
55
  "@clack/prompts": "1.7.0"
54
56
  },
55
57
  "devDependencies": {
56
- "@types/bun": "1.4.0",
57
- "typescript": "5.9.2"
58
+ "@types/bun": "1.4.0"
58
59
  },
59
60
  "engines": {
60
- "bun": ">=1.4.0"
61
+ "bun": ">=1.4.4"
61
62
  }
62
63
  }
@@ -6,7 +6,7 @@
6
6
  },
7
7
  {
8
8
  "name": "auth",
9
- "version": "1.0.1"
9
+ "version": "1.0.2"
10
10
  },
11
11
  {
12
12
  "name": "email",
@@ -17,5 +17,5 @@
17
17
  "version": "1.0.1"
18
18
  }
19
19
  ],
20
- "sha256": "f859ca8e76ee58d8bbafb162ec8e06a794c9db6586759916a8e4b4d45568c5d4"
20
+ "sha256": "209142239ace4218419e72ec0e05b88ab1b26a7b67e73cc236c9dccfb2e6d826"
21
21
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "url": "https://shibumistack.dev/ship/v49.ts",
3
- "sha256": "9c9de7cbb7c2d82ce18e429edf216c4c61df24d16a9781035db56bf70d3fad78"
4
- }
2
+ "url": "https://shibumistack.dev/ship/v51.ts",
3
+ "sha256": "73f45cbea9a8b7b1c71b80921728d4e700859e8f85cb4fcf1885f0e370fafe51"
4
+ }
package/src/args.ts CHANGED
@@ -18,9 +18,9 @@ export type ParseResult =
18
18
  | { ok: true; args: ParsedArgs }
19
19
  | { ok: false; error: string };
20
20
 
21
- // Declared minimum Bun; template lockfiles use lockfileVersion 2, which
22
- // older Bun cannot parse, so scaffolding must refuse early and clearly.
23
- export const MINIMUM_BUN = "1.4.0";
21
+ // Verified baseline for native bun check and the shipped version-2 lockfiles.
22
+ // Keep package/template engines and onboarding requirements aligned.
23
+ export const MINIMUM_BUN = "1.4.4";
24
24
 
25
25
  export function bunVersionProblem(version: string, minimum = MINIMUM_BUN): string | null {
26
26
  const parse = (value: string) => value.split("-")[0]!.split(".").map((part) => Number(part) || 0);
package/src/cli.ts CHANGED
@@ -255,14 +255,14 @@ async function adoptExisting(args: ParsedArgs): Promise<void> {
255
255
  }
256
256
 
257
257
  async function main(): Promise<void> {
258
- if (process.argv.slice(2).includes("--print-installer")) {
259
- await printInstaller();
260
- }
261
258
  const bunProblem = bunVersionProblem(Bun.version);
262
259
  if (bunProblem) {
263
260
  process.stderr.write(`${bunProblem}\n`);
264
261
  process.exit(2);
265
262
  }
263
+ if (process.argv.slice(2).includes("--print-installer")) {
264
+ await printInstaller();
265
+ }
266
266
  const parsed = parseArgs(process.argv.slice(2));
267
267
  if (!parsed.ok) {
268
268
  process.stderr.write(`${parsed.error}\nRun create-shibumi --help for usage.\n`);
package/src/create.ts CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  writeFileSync,
10
10
  } from "fs";
11
11
  import { dirname, join } from "path";
12
+ import packageJson from "../package.json";
12
13
  import { validateName, type TemplateId } from "./args";
13
14
 
14
15
  export interface CreateOptions {
@@ -139,6 +140,14 @@ export async function createProject(
139
140
  // tmp was created exclusively by mkdtemp above and is empty.
140
141
  cpSync(templateSrc, tmp, { recursive: true });
141
142
 
143
+ // The blog template's generator meta records which create-shibumi
144
+ // release scaffolded the project. Templates are static files, so the
145
+ // version is substituted here rather than evaluated at render time.
146
+ const generatorLayout = join(tmp, "src", "layout.html");
147
+ if (existsSync(generatorLayout)) {
148
+ writeFileSync(generatorLayout, readFileSync(generatorLayout, "utf8").replaceAll("{{generator-version}}", packageJson.version));
149
+ }
150
+
142
151
  // npm pack always strips .gitignore files, so templates store the file
143
152
  // as "gitignore" and it is renamed into place here.
144
153
  const packSafeIgnore = join(tmp, "gitignore");
@@ -1,10 +1,11 @@
1
1
  # Shibumi blog
2
2
 
3
- An Astro blog with the boring parts done: RSS, sitemap, OG and SEO meta from a schema your posts can't skip, an `llms.txt`, and a markdown alternate of every post for readers who curl.
3
+ A blog on the same engine as shibumistack.dev: a small Bun + Hono renderer with the boring parts done — RSS, sitemap, OG and SEO meta from a schema your posts can't skip, an `llms.txt`, and a markdown alternate of every post for readers who curl. No framework dependency; posts are markdown in `src/content/blog/` rendered by Bun's markdown engine.
4
4
 
5
5
  ```sh
6
6
  bun install
7
- bun dev
7
+ bun dev # live server on http://localhost:9001
8
+ bun build # pre-render dist/
8
9
  ```
9
10
 
10
- Write posts in `src/content/blog/`. Set `site` in `astro.config.mjs`, then `bun ship:setup` and `bun ship` to deploy. `agents.md` has the house rules.
11
+ Write posts in `src/content/blog/`. Set `url` in `src/site.ts`, then `bun ship:setup` and `bun ship` to deploy. `agents.md` has the house rules.
@@ -1,26 +1,37 @@
1
1
  # Agent Notes
2
2
 
3
- Astro blog generated by create-shibumi. Static output, shibumi design tokens, served as HTML for people and markdown for agents.
3
+ Blog generated by create-shibumi on the shibumistack.dev engine: a Bun + Hono renderer that pre-renders to static files. Built as HTML for people and markdown for agents.
4
4
 
5
5
  ## Commands
6
6
 
7
7
  ```sh
8
- bun dev # astro dev server
9
- bun run build # astro build to dist/
10
- bun run check # astro check (types + templates)
8
+ bun dev # live render on http://localhost:9001 (PORT/SHIBUMI_PORT to change)
9
+ bun run build # pre-render dist/ (same app, one pass)
10
+ bun run preview # serve dist/ locally
11
+ bun check # native type check (Bun 1.4.4+, no standalone TypeScript dependency)
11
12
  bun ship:setup # configure the deploy target (preconfigured: static, dist/, build script)
12
13
  bun ship # verify dist/, build the static image, upload, deploy
13
14
  bun ship:webhook # opt in to push-to-deploy; --off reverses it
14
15
  ```
15
16
 
17
+ ## Engine
18
+
19
+ - `src/app.ts` is a Hono app. `serve.ts` serves it live; `scripts/build.ts` pre-renders the same routes to `dist/` at build time. Nothing runs a server in production — ship packages the static output.
20
+ - `src/layout.html` is the frame: `{{tokens}}` are escaped values, `<!-- insert:name -->` markers are filled by the app, and an unresolved token or insert fails the build loudly.
21
+ - Markdown is rendered by Bun's built-in engine (`Bun.markdown.render`) with a safe renderer: raw HTML is dropped, links must be http(s)/mailto/tel/relative/fragment, images must be https or local, and code blocks get classed spans. Frontmatter is parsed with `Bun.YAML`.
22
+
23
+ ## Posts
24
+
25
+ - Posts are markdown files in `src/content/blog/` with YAML frontmatter: `title` (1 to 60 characters), `description` (50 to 160 characters; drives meta, RSS, and llms.txt), `date`, optional `ogImage` and `ogImageAlt` (alt text for the image, also used for `og:image:alt`/`twitter:image:alt`), and an optional `draft` flag (default false).
26
+ - `draft: true` keeps a post out of everything: no page, no listing, no RSS, no llms.txt, no sitemap, no markdown alternate. Publish by removing the flag and running `bun ship`.
27
+ - An invalid post (missing or out-of-range frontmatter, unsafe file name) fails `bun build` and `bun dev` with a clear message; a bad post never ships silently.
28
+ - Files in `public/` are served verbatim by URL. Reference them from markdown as absolute paths (`![alt](/photo.jpg)`).
29
+
16
30
  ## Routes and templates
17
31
 
18
- - Posts are markdown files in `src/content/blog/`; the schema in `src/content.config.ts` requires title (max 60), description (50 to 160 characters, drives meta/RSS/llms.txt), date, optional ogImage, and an optional `draft` flag (default false).
19
- - `draft: true` keeps a post out of everything: no page, no listing, no RSS, no llms.txt, no markdown alternate. Publish by removing the flag and running `bun ship`.
20
- - Images: put files in `src/assets/` and reference them relatively from the markdown (`![alt](../../assets/photo.jpg)`); Astro optimizes them at build. Files in `public/` are served verbatim by URL.
21
- - `src/pages/index.astro` lists posts; `src/pages/posts/[id].astro` renders one; `src/layouts/Base.astro` and `src/components/BaseHead.astro` own the frame and every meta tag.
22
- - Generated endpoints: `/rss.xml`, `/llms.txt`, `/robots.txt`, and a markdown alternate for every post at `/posts/<id>.md`. All derive from the content collection; never hand-edit their output.
23
- - Site identity lives in `src/site.ts`. Design lives in `public/style.css` (one file, shibumi tokens, semantic selectors).
32
+ - `/` lists posts; `/posts/<id>` renders one. Markup lives in `src/pages/index.html` and `src/pages/post.html`, styled by `public/style.css` (one file, shibumi tokens, semantic selectors).
33
+ - Generated endpoints: `/rss.xml`, `/llms.txt`, `/robots.txt`, `/sitemap.xml`, and a markdown alternate for every post at `/posts/<id>.md`. All derive from the content collection; never hand-edit their output.
34
+ - Site identity lives in `src/site.ts`, including `url`; set it to the real domain before the first ship — canonicals, og:url, RSS, and the sitemap derive from it.
24
35
 
25
36
  ## Trust boundaries and validation
26
37
 
@@ -36,4 +47,4 @@ None.
36
47
 
37
48
  ## Checks required before commit
38
49
 
39
- Set `site` in `astro.config.mjs` to the real domain before the first `bun ship`; sitemap, RSS, canonicals, and og:url derive from it. `bun run check` and `bun run build` must pass. Keep `build.format: "directory"` so the static server routes clean URLs.
50
+ Set `url` in `src/site.ts` to the real domain before the first `bun ship`. `bun run check` and `bun run build` must pass; the build fails on any unresolved template token, unvalidated frontmatter, or unsafe file name.