Skip to content

Commit bd590fa

Browse files
committed
fix(quoteforge[new]): offer all templates instead of a hardcoded four
1 parent 3cb8c6b commit bd590fa

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
### Fixed
2525
- Unknown template names now fail with a clear error naming the available templates, instead
26-
of rendering a blank card.
26+
of a raw `ENOENT` stack trace for the template's missing `style.css`.
2727

2828
## 0.6.0
2929

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ quoteforge preview <file> [options]
147147
quoteforge new [options]
148148
149149
--type <type> card or deck
150-
--template <name> Template name (manifesto, quote, list, minimal)
150+
--template <name> Template name (28 available — omit for a picker)
151151
--theme <name> Theme name
152152
--slides <n> Number of blank slides (deck only, default: 5)
153153
--size <name> Size name
@@ -350,7 +350,7 @@ work.
350350
- `src/` — CLI + renderer (Bun + Nunjucks + Puppeteer)
351351
- `studio/` — bundled WYSIWYG editor (Vite + React + Zustand, launched by `quoteforge studio`)
352352
- `site/` — standalone landing + MDX docs SPA (separate nginx Dockerfile for deployment)
353-
- `templates/`four built-in card layouts sharing a responsive base CSS
353+
- `templates/`28 built-in card layouts sharing a responsive base CSS
354354
- `themes/` — 12 JSON theme files conforming to `_schema.json`
355355

356356
## Stack

src/cli/commands/new.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import * as clack from "@clack/prompts";
44
import { writeFileSync, existsSync } from "node:fs";
55
import { resolve } from "node:path";
66
import { listAllThemes } from "../../assetBundle.js";
7+
import { listTemplates, assertTemplateExists } from "../../renderer/templates.js";
78

89
function getAvailableThemes(): string[] {
910
return listAllThemes().map((t) => t.name);
1011
}
1112

12-
const TEMPLATES = ["manifesto", "quote", "list", "minimal"];
1313

1414
export const newCommand = new Command("new")
1515
.description("Interactively create a new card or deck JSON file")
@@ -42,9 +42,18 @@ export const newCommand = new Command("new")
4242
process.exit(0);
4343
}
4444

45+
if (opts.template) {
46+
try {
47+
assertTemplateExists(opts.template);
48+
} catch (err: unknown) {
49+
clack.cancel(err instanceof Error ? err.message : String(err));
50+
process.exit(1);
51+
}
52+
}
53+
4554
const template = opts.template ?? await clack.select({
4655
message: "Pick a template:",
47-
options: TEMPLATES.map((t) => ({ value: t, label: t })),
56+
options: listTemplates().map((t) => ({ value: t, label: t })),
4857
});
4958

5059
if (clack.isCancel(template)) {

0 commit comments

Comments
 (0)