dogsbay 0.2.0-beta.1 → 0.2.0-beta.2
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.
|
@@ -244,8 +244,9 @@ export async function siteBuild(cwd, options) {
|
|
|
244
244
|
}
|
|
245
245
|
console.log("");
|
|
246
246
|
console.log(pc.cyan("Next:"));
|
|
247
|
-
console.log("
|
|
248
|
-
console.log(" dogsbay site
|
|
247
|
+
console.log(" dogsbay site dev # live preview at http://localhost:4321");
|
|
248
|
+
console.log(" dogsbay site preview # production build → dist/ + serve");
|
|
249
|
+
console.log(" dogsbay site check # run audit rules");
|
|
249
250
|
}
|
|
250
251
|
// ─── Helpers ─────────────────────────────────────────────────────────────
|
|
251
252
|
function resolveConfigPath(startDir, explicit) {
|
|
@@ -32,6 +32,36 @@ const defaultRunner = (siteRoot, args) => new Promise((resolve) => {
|
|
|
32
32
|
resolve(1);
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
|
+
/**
|
|
36
|
+
* Pick the first available package manager from a preference list.
|
|
37
|
+
* Defaults to pnpm (matches the dogsbay tooling chain); falls back
|
|
38
|
+
* to npm so machines without pnpm don't dead-end.
|
|
39
|
+
*/
|
|
40
|
+
function pickPackageManager() {
|
|
41
|
+
const onPath = (cmd) => {
|
|
42
|
+
try {
|
|
43
|
+
const { execSync } = require("node:child_process");
|
|
44
|
+
execSync(`command -v ${cmd}`, { stdio: "ignore" });
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (onPath("pnpm"))
|
|
52
|
+
return "pnpm";
|
|
53
|
+
return "npm";
|
|
54
|
+
}
|
|
55
|
+
function runPackageManagerInstall(pm, cwd) {
|
|
56
|
+
return new Promise((resolve) => {
|
|
57
|
+
const child = spawn(pm, ["install"], { cwd, stdio: "inherit" });
|
|
58
|
+
child.on("exit", (code) => resolve(code ?? 0));
|
|
59
|
+
child.on("error", (err) => {
|
|
60
|
+
console.error(pc.red(`Error: failed to spawn ${pm}: ${err.message}`));
|
|
61
|
+
resolve(1);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
35
65
|
export async function siteDev(cwd, options, runner = defaultRunner) {
|
|
36
66
|
const siteRoot = await prepareForAstro(cwd, options);
|
|
37
67
|
const code = await runner(siteRoot, ["dev"]);
|
|
@@ -61,9 +91,18 @@ async function prepareForAstro(cwd, options) {
|
|
|
61
91
|
process.exit(1);
|
|
62
92
|
}
|
|
63
93
|
if (!existsSync(join(outputDir, "node_modules"))) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
94
|
+
// First-run: install scaffolded site's deps automatically. Picks
|
|
95
|
+
// pnpm if available, otherwise npm. Friendly users shouldn't have
|
|
96
|
+
// to know this is a separate project under the hood — the
|
|
97
|
+
// dogsbay command should Just Work the first time.
|
|
98
|
+
const pm = pickPackageManager();
|
|
99
|
+
console.log(pc.cyan(`Installing scaffolded site deps (one-time, ~30s) — using ${pm}...`));
|
|
100
|
+
const installCode = await runPackageManagerInstall(pm, outputDir);
|
|
101
|
+
if (installCode !== 0) {
|
|
102
|
+
console.error(pc.red(`Error: ${pm} install failed in ${outputDir} (exit ${installCode}).`));
|
|
103
|
+
console.error(` Try running \`${pm} install\` manually in that directory.`);
|
|
104
|
+
process.exit(installCode);
|
|
105
|
+
}
|
|
67
106
|
}
|
|
68
107
|
// Refresh content / config-derived / agent-readiness files before
|
|
69
108
|
// handing off to Astro. Skip with --no-build for fast iteration when
|
|
@@ -417,11 +417,14 @@ function printNextSteps(absTarget, outputDir, config, starterContentPath) {
|
|
|
417
417
|
console.log(` ${outputDir}/src/components/ui/`);
|
|
418
418
|
console.log("");
|
|
419
419
|
console.log(pc.cyan("Next steps:"));
|
|
420
|
-
console.log(` cd ${outputDir}`);
|
|
421
|
-
console.log(" pnpm install");
|
|
422
420
|
if (!sameDir)
|
|
423
421
|
console.log(` cd ${absTarget}`);
|
|
424
|
-
console.log(" dogsbay site build");
|
|
425
|
-
console.log("
|
|
422
|
+
console.log(" dogsbay site dev # build + live preview at http://localhost:4321");
|
|
423
|
+
console.log(" (auto-installs scaffolded deps on first run)");
|
|
424
|
+
console.log("");
|
|
425
|
+
console.log("Other commands:");
|
|
426
|
+
console.log(" dogsbay site build # generate Astro source from content");
|
|
427
|
+
console.log(" dogsbay site preview # production build + serve from dist/");
|
|
428
|
+
console.log(" dogsbay site check # run audit rules against built content");
|
|
426
429
|
console.log("");
|
|
427
430
|
}
|
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.2",
|
|
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-
|
|
37
|
-
"@dogsbay/format-starlight": "0.2.0-beta.
|
|
38
|
-
"@dogsbay/format-dogsbay-md": "0.2.0-beta.
|
|
39
|
-
"@dogsbay/
|
|
40
|
-
"@dogsbay/
|
|
33
|
+
"@dogsbay/format-mkdocs": "0.2.0-beta.2",
|
|
34
|
+
"@dogsbay/format-astro": "0.2.0-beta.2",
|
|
35
|
+
"@dogsbay/format-mdx": "0.2.0-beta.2",
|
|
36
|
+
"@dogsbay/format-obsidian": "0.2.0-beta.2",
|
|
37
|
+
"@dogsbay/format-starlight": "0.2.0-beta.2",
|
|
38
|
+
"@dogsbay/format-dogsbay-md": "0.2.0-beta.2",
|
|
39
|
+
"@dogsbay/types": "0.2.0-beta.2",
|
|
40
|
+
"@dogsbay/format-openapi": "0.2.0-beta.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^22.0.0",
|