dogsbay 0.2.0-beta.11 → 0.2.0-beta.13

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.
@@ -3,13 +3,18 @@
3
3
  * run `dogsbay site build`, watch content for changes, and hand
4
4
  * control over to the Astro CLI inside the site directory.
5
5
  *
6
- * dev → astro dev (live HMR for already-built pages)
7
- * preview → astro build && astro preview
6
+ * dev → astro dev (live HMR for already-built pages)
7
+ * preview → <pm> run build astro preview
8
8
  *
9
9
  * The site dir is found by locating `dogsbay.config.{yml,yaml,json}`
10
- * at or above cwd (or via --config). `npm run build` (the user's
11
- * existing script) is *not* what runs here — we shell out to `astro`
12
- * directly so this works whether the user uses pnpm / npm / yarn.
10
+ * at or above cwd (or via --config).
11
+ *
12
+ * site dev shells `npx astro dev` directly fast, no script
13
+ * indirection. site preview needs the production build to match
14
+ * what's actually deployed, which means running the scaffolded
15
+ * package.json `build` script (chains `astro build && pagefind
16
+ * --site dist` so Cmd+K search works in the previewed dist/). The
17
+ * package manager is auto-detected (pnpm if on PATH, otherwise npm).
13
18
  *
14
19
  * `site dev` also installs a content watcher that re-runs
15
20
  * `dogsbay site build` whenever a markdown / yaml / json file under
@@ -37,6 +42,18 @@ const defaultRunner = (siteRoot, args) => new Promise((resolve) => {
37
42
  resolve(1);
38
43
  });
39
44
  });
45
+ const defaultBuildRunner = (siteRoot) => new Promise((resolve) => {
46
+ const pm = pickPackageManager();
47
+ const child = spawn(pm, ["run", "build"], {
48
+ cwd: siteRoot,
49
+ stdio: "inherit",
50
+ });
51
+ child.on("exit", (code) => resolve(code ?? 0));
52
+ child.on("error", (err) => {
53
+ console.error(pc.red(`Error: failed to spawn ${pm} run build: ${err.message}`));
54
+ resolve(1);
55
+ });
56
+ });
40
57
  /**
41
58
  * Pick the first available package manager from a preference list.
42
59
  * Defaults to pnpm (matches the dogsbay tooling chain); falls back
@@ -80,11 +97,13 @@ export async function siteDev(cwd, options, runner = defaultRunner) {
80
97
  throw err;
81
98
  }
82
99
  }
83
- export async function sitePreview(cwd, options, runner = defaultRunner) {
100
+ export async function sitePreview(cwd, options, runner = defaultRunner, buildRunner = defaultBuildRunner) {
84
101
  const { outputDir } = await prepareForAstro(cwd, options);
85
- // Two-step: produce dist/ then serve it. Each spawn is independent
86
- // so we can still surface its exit code cleanly.
87
- const buildCode = await runner(outputDir, ["build"]);
102
+ // Two-step: produce dist/ via the scaffolded `build` script
103
+ // (astro build + pagefind), then serve it via astro preview. The
104
+ // build script is the source of truth — `astro build` alone would
105
+ // skip pagefind and Cmd+K search in the previewed dist/ would 404.
106
+ const buildCode = await buildRunner(outputDir);
88
107
  if (buildCode !== 0)
89
108
  process.exit(buildCode);
90
109
  const previewCode = await runner(outputDir, ["preview"]);
package/dist/registry.js CHANGED
@@ -388,6 +388,14 @@ export const registry = {
388
388
  primitives: [],
389
389
  description: "Clickable card with link",
390
390
  },
391
+ icon: {
392
+ name: "icon",
393
+ files: ["Icon.astro", "index.ts"],
394
+ dependencies: ["@dogsbay/icons"],
395
+ registryDependencies: [],
396
+ primitives: [],
397
+ description: "Build-time-resolved icon (Lucide default; mdi:, simple-icons:, etc. via Iconify)",
398
+ },
391
399
  sidebar: {
392
400
  name: "sidebar",
393
401
  files: ["Sidebar.astro", "SidebarContent.astro", "SidebarGroup.astro", "SidebarGroupContent.astro", "SidebarGroupLabel.astro", "SidebarHeader.astro", "SidebarInset.astro", "SidebarMenu.astro", "SidebarMenuButton.astro", "SidebarMenuItem.astro", "SidebarNavTree.astro", "SidebarProvider.astro", "SidebarRail.astro", "SidebarSeparator.astro", "SidebarTrigger.astro", "sidebar.ts", "index.ts"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dogsbay",
3
- "version": "0.2.0-beta.11",
3
+ "version": "0.2.0-beta.13",
4
4
  "description": "CLI for Dogsbay — scaffold, build, and serve documentation sites with markdown / MkDocs / Obsidian / OpenAPI sources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,14 +32,14 @@
32
32
  "picocolors": "^1.1.0",
33
33
  "prompts": "^2.4.2",
34
34
  "yaml": "^2.8.3",
35
- "@dogsbay/format-obsidian": "0.2.0-beta.11",
36
- "@dogsbay/format-astro": "0.2.0-beta.11",
37
- "@dogsbay/format-mkdocs": "0.2.0-beta.11",
38
- "@dogsbay/format-mdx": "0.2.0-beta.11",
39
- "@dogsbay/format-openapi": "0.2.0-beta.11",
40
- "@dogsbay/format-dogsbay-md": "0.2.0-beta.11",
41
- "@dogsbay/types": "0.2.0-beta.11",
42
- "@dogsbay/format-starlight": "0.2.0-beta.11"
35
+ "@dogsbay/format-mkdocs": "0.2.0-beta.13",
36
+ "@dogsbay/format-astro": "0.2.0-beta.13",
37
+ "@dogsbay/format-mdx": "0.2.0-beta.13",
38
+ "@dogsbay/format-starlight": "0.2.0-beta.13",
39
+ "@dogsbay/format-obsidian": "0.2.0-beta.13",
40
+ "@dogsbay/format-dogsbay-md": "0.2.0-beta.13",
41
+ "@dogsbay/format-openapi": "0.2.0-beta.13",
42
+ "@dogsbay/types": "0.2.0-beta.13"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^22.0.0",
@@ -177,6 +177,54 @@ icon: rocket
177
177
 
178
178
  Both forms are accepted by the parser.
179
179
 
180
+ ## Link card (`:::link-card`)
181
+
182
+ A focused variant of `:::card` for "go here next" navigation
183
+ affordances. Renders a chevron arrow on the right and a
184
+ distinctive hover state — visually clearer that it's a link
185
+ rather than a content tile.
186
+
187
+ ```markdown
188
+ :::link-card{title="Configuration guide" href="/config/"}
189
+ Site name, theme, base path, and per-source settings live in
190
+ dogsbay.config.yml.
191
+ :::
192
+ ```
193
+
194
+ YAML body form when prop count or content grows:
195
+
196
+ ```markdown
197
+ :::link-card
198
+ ---
199
+ title: Configuration guide
200
+ description: |
201
+ Site name, theme, base path, and per-source settings live in
202
+ dogsbay.config.yml.
203
+ href: /config/
204
+ ---
205
+ :::
206
+ ```
207
+
208
+ Props: `title` (required), `href` (required), `description`
209
+ (optional — also accepted as the body paragraph for ergonomic
210
+ authoring). No `icon` slot — link-cards intentionally lean on
211
+ the chevron alone for the link affordance. When you need an
212
+ icon, use `:::card`.
213
+
214
+ ### When to pick which card directive
215
+
216
+ - **`:::cards`** (plural) — list of related links, displayed as
217
+ a responsive grid. Best for "browse next" clusters at the
218
+ end of a page or on a landing page. Items are bulleted-link
219
+ shorthand.
220
+ - **`:::card`** (singular) — one rich card with full prop
221
+ surface (`icon`, `variant`, custom classes, arbitrary body).
222
+ Use when you want a tile with deliberate visual weight.
223
+ - **`:::link-card`** — one card scoped to a single navigation
224
+ link, with chevron arrow. Use for callouts that lead the
225
+ reader somewhere specific ("Continue with Configuration
226
+ guide →").
227
+
180
228
  ## Grid
181
229
 
182
230
  Generic responsive grid container with `cols` and `gap` attrs: