barodoc 8.1.0 → 8.2.0

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.
@@ -114,6 +114,11 @@ async function createProject(options) {
114
114
  await fs.copy(pagesDir, pagesDest);
115
115
  console.log(pc.dim(" Copied pages/ directory"));
116
116
  }
117
+ await fs.writeFile(
118
+ path.join(contentDir, "config.ts"),
119
+ generateContentConfig(config),
120
+ "utf-8"
121
+ );
117
122
  const publicDir = path.join(root, "public");
118
123
  const publicLink = path.join(projectDir, "public");
119
124
  if (fs.existsSync(publicDir)) {
@@ -162,6 +167,54 @@ export default defineConfig({${siteLine}${baseLine}
162
167
  });
163
168
  `;
164
169
  }
170
+ var contentSchema = `z.object({
171
+ title: z.string().optional(),
172
+ description: z.string().optional(),
173
+ tags: z.array(z.string()).optional(),
174
+ related: z.array(z.string()).optional(),
175
+ category: z.string().optional(),
176
+ api_reference: z.boolean().optional(),
177
+ difficulty: z.enum(["beginner", "intermediate", "advanced"]).optional(),
178
+ lastUpdated: z.date().optional(),
179
+ })`;
180
+ function generateContentConfig(config) {
181
+ const collections = [
182
+ `docs: defineCollection({ type: "content", schema: ${contentSchema} })`,
183
+ `blog: defineCollection({
184
+ type: "content",
185
+ schema: z.object({
186
+ title: z.string(),
187
+ description: z.string().optional(),
188
+ excerpt: z.string().optional(),
189
+ date: z.coerce.date().optional(),
190
+ author: z.string().optional(),
191
+ image: z.string().optional(),
192
+ tags: z.array(z.string()).optional(),
193
+ }),
194
+ })`,
195
+ `changelog: defineCollection({
196
+ type: "content",
197
+ schema: z.object({
198
+ title: z.string().optional(),
199
+ version: z.string(),
200
+ date: z.coerce.date(),
201
+ }),
202
+ })`,
203
+ `pages: defineCollection({ type: "content", schema: ${contentSchema} })`
204
+ ];
205
+ const sections = config.sections ?? [];
206
+ for (const section of sections) {
207
+ collections.push(
208
+ `${section.slug}: defineCollection({ type: "content", schema: ${contentSchema} })`
209
+ );
210
+ }
211
+ return `import { defineCollection, z } from "astro:content";
212
+
213
+ export const collections = {
214
+ ${collections.join(",\n ")},
215
+ };
216
+ `;
217
+ }
165
218
  function findDocsDir(root) {
166
219
  const candidates = ["docs", "content", "src/content/docs"];
167
220
  for (const candidate of candidates) {
package/dist/cli.js CHANGED
@@ -6,14 +6,14 @@ import {
6
6
  generateAstroConfigFile,
7
7
  isCustomProject,
8
8
  loadProjectConfig
9
- } from "./chunk-EFTFHBH3.js";
9
+ } from "./chunk-ECBEFAJA.js";
10
10
 
11
11
  // src/cli.ts
12
12
  import cac from "cac";
13
13
  import pc10 from "picocolors";
14
14
 
15
15
  // package.json
16
- var version = "8.1.0";
16
+ var version = "8.2.0";
17
17
 
18
18
  // src/commands/serve.ts
19
19
  import path from "path";
@@ -22,7 +22,7 @@ import { dev } from "astro";
22
22
  import barodoc from "@barodoc/core";
23
23
  import docsTheme from "@barodoc/theme-docs/theme";
24
24
  async function serve(dir, options) {
25
- const root = path.resolve(process.cwd());
25
+ const root = !dir || dir === "." ? path.resolve(process.cwd()) : path.resolve(process.cwd(), dir);
26
26
  console.log();
27
27
  console.log(pc.bold(pc.cyan(" barodoc serve")));
28
28
  console.log();
@@ -39,7 +39,7 @@ async function serve(dir, options) {
39
39
  return;
40
40
  }
41
41
  console.log(pc.dim("Quick mode - creating temporary project..."));
42
- const docsDir = !dir || dir === "." ? findDocsDir(root) : path.resolve(root, dir);
42
+ const docsDir = findDocsDir(root);
43
43
  const { config } = await loadProjectConfig(root, options.config);
44
44
  const projectDir = await createProject({
45
45
  root,
@@ -90,8 +90,8 @@ import { build as astroBuild } from "astro";
90
90
  import barodoc2 from "@barodoc/core";
91
91
  import docsTheme2 from "@barodoc/theme-docs/theme";
92
92
  async function build(dir, options) {
93
- const root = path2.resolve(process.cwd());
94
- const outputDir = path2.resolve(process.cwd(), options.output);
93
+ const root = !dir || dir === "." ? path2.resolve(process.cwd()) : path2.resolve(process.cwd(), dir);
94
+ const outputDir = path2.resolve(root, options.output);
95
95
  console.log();
96
96
  console.log(pc2.bold(pc2.cyan(" barodoc build")));
97
97
  console.log();
@@ -103,7 +103,7 @@ async function build(dir, options) {
103
103
  return;
104
104
  }
105
105
  console.log(pc2.dim("Quick mode - creating temporary project..."));
106
- const docsDir = !dir || dir === "." ? findDocsDir(root) : path2.resolve(root, dir);
106
+ const docsDir = findDocsDir(root);
107
107
  const { config } = await loadProjectConfig(root, options.config);
108
108
  const projectDir = await createProject({
109
109
  root,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cleanupProject,
3
3
  createProject
4
- } from "./chunk-EFTFHBH3.js";
4
+ } from "./chunk-ECBEFAJA.js";
5
5
 
6
6
  // src/index.ts
7
7
  export * from "@barodoc/core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "barodoc",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "Documentation framework powered by Astro",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,6 +26,7 @@
26
26
  "tailwindcss": "^4.0.0",
27
27
  "react": "^19.0.0",
28
28
  "react-dom": "^19.0.0",
29
+ "rst-compiler": "^0.5.7",
29
30
  "cac": "^6.7.14",
30
31
  "chokidar": "^4.0.0",
31
32
  "execa": "^9.5.0",
@@ -34,17 +35,17 @@
34
35
  "picocolors": "^1.1.1",
35
36
  "zod": "^3.24.0",
36
37
  "zod-to-json-schema": "^3.25.1",
37
- "@barodoc/theme-docs": "8.0.2",
38
38
  "@barodoc/core": "8.0.0",
39
+ "@barodoc/theme-docs": "8.2.0",
39
40
  "@barodoc/plugin-analytics": "8.0.0",
40
41
  "@barodoc/plugin-docsearch": "8.0.0",
42
+ "@barodoc/plugin-llms-txt": "8.0.0",
41
43
  "@barodoc/plugin-og-image": "7.0.0",
42
44
  "@barodoc/plugin-openapi": "8.0.0",
43
- "@barodoc/plugin-llms-txt": "8.0.0",
44
45
  "@barodoc/plugin-pwa": "8.0.0",
45
- "@barodoc/plugin-rss": "8.0.0",
46
- "@barodoc/plugin-sitemap": "8.0.0",
47
- "@barodoc/plugin-search": "8.0.0"
46
+ "@barodoc/plugin-rss": "8.0.1",
47
+ "@barodoc/plugin-search": "8.0.0",
48
+ "@barodoc/plugin-sitemap": "8.0.0"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@types/fs-extra": "^11.0.4",