dogsbay 0.2.0-beta.0 → 0.2.0-beta.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.
- package/dist/commands/site-init.js +54 -3
- package/dist/index.js +11 -1
- package/package.json +9 -9
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* `dogsbay site build`.
|
|
16
16
|
*/
|
|
17
17
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
18
|
-
import { join, resolve } from "node:path";
|
|
18
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
19
19
|
import pc from "picocolors";
|
|
20
20
|
import prompts from "prompts";
|
|
21
21
|
import { emitSiteScaffold } from "@dogsbay/format-astro";
|
|
@@ -107,7 +107,55 @@ export async function siteInit(targetDir, options) {
|
|
|
107
107
|
if (options.local)
|
|
108
108
|
astroOpts.local = true;
|
|
109
109
|
emitSiteScaffold(outputDir, config.site.name, astroOpts, true);
|
|
110
|
-
|
|
110
|
+
// Seed starter content so the first `dogsbay site build` succeeds
|
|
111
|
+
// without manual intervention. Only writes when this is a fresh
|
|
112
|
+
// init (writeConfig=true; scaffold-only consumers already have
|
|
113
|
+
// content) and the content dir doesn't exist yet — never
|
|
114
|
+
// overwrites user files. See plans/beta-launch-followups.md.
|
|
115
|
+
let starterContentPath = null;
|
|
116
|
+
if (writeConfig) {
|
|
117
|
+
starterContentPath = seedStarterContent(absTarget, config);
|
|
118
|
+
}
|
|
119
|
+
printNextSteps(absTarget, outputDir, config, starterContentPath);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create a starter `<content>/index.md` if the content dir doesn't
|
|
123
|
+
* already exist. Returns the path written, or null when nothing
|
|
124
|
+
* was created (dir already populated). Never overwrites.
|
|
125
|
+
*/
|
|
126
|
+
function seedStarterContent(absTarget, config) {
|
|
127
|
+
const sources = config.content.sources ?? [];
|
|
128
|
+
const first = sources[0];
|
|
129
|
+
if (!first?.path)
|
|
130
|
+
return null;
|
|
131
|
+
const contentDir = isAbsolute(first.path)
|
|
132
|
+
? first.path
|
|
133
|
+
: join(absTarget, first.path);
|
|
134
|
+
if (existsSync(contentDir))
|
|
135
|
+
return null; // user already has content
|
|
136
|
+
mkdirSync(contentDir, { recursive: true });
|
|
137
|
+
const indexPath = join(contentDir, "index.md");
|
|
138
|
+
writeFileSync(indexPath, `---
|
|
139
|
+
title: ${config.site.name || "Welcome"}
|
|
140
|
+
description: Edit content/index.md to get started.
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
# ${config.site.name || "Welcome"}
|
|
144
|
+
|
|
145
|
+
This is your starter page. Replace this content with your own
|
|
146
|
+
markdown — every \`.md\` file under \`content/\` becomes a page.
|
|
147
|
+
|
|
148
|
+
## What's next
|
|
149
|
+
|
|
150
|
+
- Edit this file (\`content/index.md\`) to change the home page.
|
|
151
|
+
- Add more \`.md\` files alongside it for additional pages.
|
|
152
|
+
- Run \`dogsbay site dev\` to preview live as you edit.
|
|
153
|
+
- See \`dogsbay.config.yml\` for site-wide settings (theme, agent
|
|
154
|
+
readiness, deploy target, etc.).
|
|
155
|
+
|
|
156
|
+
For the full reference, see https://github.com/dogsbay/dogsbay.
|
|
157
|
+
`);
|
|
158
|
+
return indexPath;
|
|
111
159
|
}
|
|
112
160
|
// ─── Resolution: flags + prompts → DogsbayConfig ─────────────────────────
|
|
113
161
|
async function resolveConfig(opts, interactive) {
|
|
@@ -353,12 +401,15 @@ function findExistingConfig(dir) {
|
|
|
353
401
|
}
|
|
354
402
|
return null;
|
|
355
403
|
}
|
|
356
|
-
function printNextSteps(absTarget, outputDir, config) {
|
|
404
|
+
function printNextSteps(absTarget, outputDir, config, starterContentPath) {
|
|
357
405
|
void config;
|
|
358
406
|
const sameDir = absTarget === outputDir;
|
|
359
407
|
console.log("");
|
|
360
408
|
console.log(pc.green("Wrote:"));
|
|
361
409
|
console.log(` ${absTarget}/dogsbay.config.yml`);
|
|
410
|
+
if (starterContentPath) {
|
|
411
|
+
console.log(` ${starterContentPath}`);
|
|
412
|
+
}
|
|
362
413
|
console.log(` ${outputDir}/package.json`);
|
|
363
414
|
console.log(` ${outputDir}/astro.config.mjs`);
|
|
364
415
|
console.log(` ${outputDir}/src/styles/theme.css`);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
2
5
|
import { Command } from "commander";
|
|
3
6
|
import { init } from "./commands/init.js";
|
|
4
7
|
import { add, list } from "./commands/add.js";
|
|
@@ -12,11 +15,18 @@ import { siteInit } from "./commands/site-init.js";
|
|
|
12
15
|
import { siteBuild } from "./commands/site-build.js";
|
|
13
16
|
import { siteCheck } from "./commands/site-check.js";
|
|
14
17
|
import { siteDev, sitePreview } from "./commands/site-dev.js";
|
|
18
|
+
// Read version from the runtime package.json so `dogsbay --version`
|
|
19
|
+
// never drifts from what's published. Walks one level up from
|
|
20
|
+
// `dist/index.js` to `package.json` (works in both monorepo dev and
|
|
21
|
+
// the published tarball — pnpm/npm both keep package.json next to
|
|
22
|
+
// dist/).
|
|
23
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
15
25
|
const program = new Command();
|
|
16
26
|
program
|
|
17
27
|
.name("dogsbay")
|
|
18
28
|
.description("Documentation site generator + Astro component library")
|
|
19
|
-
.version(
|
|
29
|
+
.version(pkg.version);
|
|
20
30
|
// ── `dogsbay astro` — drop Dogsbay components into an existing Astro project ──
|
|
21
31
|
const astro = program
|
|
22
32
|
.command("astro")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dogsbay",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.1",
|
|
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": {
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"picocolors": "^1.1.0",
|
|
31
31
|
"prompts": "^2.4.2",
|
|
32
32
|
"yaml": "^2.8.3",
|
|
33
|
-
"@dogsbay/format-mkdocs": "0.2.0-beta.
|
|
34
|
-
"@dogsbay/format-
|
|
35
|
-
"@dogsbay/format-
|
|
36
|
-
"@dogsbay/format-mdx": "0.2.0-beta.
|
|
37
|
-
"@dogsbay/format-starlight": "0.2.0-beta.
|
|
38
|
-
"@dogsbay/format-dogsbay-md": "0.2.0-beta.
|
|
39
|
-
"@dogsbay/format-openapi": "0.2.0-beta.
|
|
40
|
-
"@dogsbay/types": "0.2.0-beta.
|
|
33
|
+
"@dogsbay/format-mkdocs": "0.2.0-beta.1",
|
|
34
|
+
"@dogsbay/format-obsidian": "0.2.0-beta.1",
|
|
35
|
+
"@dogsbay/format-astro": "0.2.0-beta.1",
|
|
36
|
+
"@dogsbay/format-mdx": "0.2.0-beta.1",
|
|
37
|
+
"@dogsbay/format-starlight": "0.2.0-beta.1",
|
|
38
|
+
"@dogsbay/format-dogsbay-md": "0.2.0-beta.1",
|
|
39
|
+
"@dogsbay/format-openapi": "0.2.0-beta.1",
|
|
40
|
+
"@dogsbay/types": "0.2.0-beta.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^22.0.0",
|