doccupine 0.0.157 → 0.0.158
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/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
- **MCP server** - exposes `search_docs`, `get_doc`, and `list_docs` tools for AI agents
|
|
26
26
|
- **Custom fonts** - Google Fonts or local fonts via `fonts.json`
|
|
27
27
|
- **Static assets** - `public/` directory is watched and synced to the generated app
|
|
28
|
-
- **Lean icons** - only the Lucide glyphs your pages, navigation, and components use are bundled; an unknown icon name warns when the site is generated and renders nothing
|
|
28
|
+
- **Lean icons** - only the Lucide glyphs your pages, navigation, footer links, and components use are bundled; an unknown icon name warns when the site is generated and renders nothing
|
|
29
29
|
- **Password protection** - gate the whole site behind a shared password with `SITE_PASSWORD`
|
|
30
30
|
- **Zero config to start** - `npx doccupine` scaffolds everything and starts the server
|
|
31
31
|
|
|
@@ -3,10 +3,10 @@ import type { PageMeta } from "../lib/types.js";
|
|
|
3
3
|
export declare function builtinIconNames(): string[];
|
|
4
4
|
/**
|
|
5
5
|
* Keeps `components/layout/IconRegistry.ts` in step with the icon names the
|
|
6
|
-
* site uses: sidebar icons from frontmatter, `icon` entries in navigation.json
|
|
7
|
-
* `<Icon>` and `icon` props in MDX, and the glyphs the
|
|
8
|
-
* draw themselves. Unknown names are reported once and
|
|
9
|
-
* renders nothing rather than failing the build.
|
|
6
|
+
* site uses: sidebar icons from frontmatter, `icon` entries in navigation.json
|
|
7
|
+
* and links.json, `<Icon>` and `icon` props in MDX, and the glyphs the
|
|
8
|
+
* generated components draw themselves. Unknown names are reported once and
|
|
9
|
+
* left out, so a typo renders nothing rather than failing the build.
|
|
10
10
|
*/
|
|
11
11
|
export declare class IconRegistryGenerator {
|
|
12
12
|
private readonly outputDir;
|
|
@@ -18,7 +18,10 @@ export declare class IconRegistryGenerator {
|
|
|
18
18
|
constructor(outputDir: string, builtinNames?: readonly string[]);
|
|
19
19
|
/** Called after every MDX pass with the published pages and their sources. */
|
|
20
20
|
updateFromPages(pages: readonly PageMeta[], mdxSources: ReadonlyMap<string, string>): Promise<void>;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Re-reads navigation.json and links.json (already copied to the output)
|
|
23
|
+
* and rewrites.
|
|
24
|
+
*/
|
|
22
25
|
refresh(): Promise<void>;
|
|
23
26
|
/**
|
|
24
27
|
* Scaffold-time guarantee that the file the Icon template imports exists.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import { ICON_REGISTRY_FILE, INDIRECT_TEMPLATE_ICON_NAMES,
|
|
2
|
+
import { ICON_CONFIG_FILES, ICON_REGISTRY_FILE, INDIRECT_TEMPLATE_ICON_NAMES, collectConfigIconNames, collectMdxIconNames, collectTemplateIconNames, renderIconRegistry, resolveLucideIconName, } from "../lib/icon-registry.js";
|
|
3
3
|
import { readOutputFileIfPresent, resolveOutputPath, } from "../lib/output-safety.js";
|
|
4
4
|
import { appStructure } from "../lib/structures.js";
|
|
5
5
|
import { writeFileAtomic } from "../lib/utils.js";
|
|
@@ -12,10 +12,10 @@ export function builtinIconNames() {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Keeps `components/layout/IconRegistry.ts` in step with the icon names the
|
|
15
|
-
* site uses: sidebar icons from frontmatter, `icon` entries in navigation.json
|
|
16
|
-
* `<Icon>` and `icon` props in MDX, and the glyphs the
|
|
17
|
-
* draw themselves. Unknown names are reported once and
|
|
18
|
-
* renders nothing rather than failing the build.
|
|
15
|
+
* site uses: sidebar icons from frontmatter, `icon` entries in navigation.json
|
|
16
|
+
* and links.json, `<Icon>` and `icon` props in MDX, and the glyphs the
|
|
17
|
+
* generated components draw themselves. Unknown names are reported once and
|
|
18
|
+
* left out, so a typo renders nothing rather than failing the build.
|
|
19
19
|
*/
|
|
20
20
|
export class IconRegistryGenerator {
|
|
21
21
|
outputDir;
|
|
@@ -34,7 +34,10 @@ export class IconRegistryGenerator {
|
|
|
34
34
|
this.mdxSources = mdxSources;
|
|
35
35
|
await this.write();
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Re-reads navigation.json and links.json (already copied to the output)
|
|
39
|
+
* and rewrites.
|
|
40
|
+
*/
|
|
38
41
|
async refresh() {
|
|
39
42
|
await this.write();
|
|
40
43
|
}
|
|
@@ -50,7 +53,7 @@ export class IconRegistryGenerator {
|
|
|
50
53
|
return;
|
|
51
54
|
await this.write();
|
|
52
55
|
}
|
|
53
|
-
collectReferences(
|
|
56
|
+
collectReferences(configs) {
|
|
54
57
|
const references = this.builtinNames.map((name) => ({
|
|
55
58
|
name,
|
|
56
59
|
source: "",
|
|
@@ -74,16 +77,21 @@ export class IconRegistryGenerator {
|
|
|
74
77
|
references.push({ name, source });
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
|
-
for (const
|
|
78
|
-
|
|
80
|
+
for (const [fileName, json] of configs) {
|
|
81
|
+
for (const name of collectConfigIconNames(json)) {
|
|
82
|
+
references.push({ name, source: fileName });
|
|
83
|
+
}
|
|
79
84
|
}
|
|
80
85
|
return references;
|
|
81
86
|
}
|
|
82
87
|
async write() {
|
|
83
|
-
const
|
|
88
|
+
const configs = new Map();
|
|
89
|
+
for (const fileName of ICON_CONFIG_FILES) {
|
|
90
|
+
configs.set(fileName, await readOutputFileIfPresent(this.outputDir, fileName));
|
|
91
|
+
}
|
|
84
92
|
const ids = new Set();
|
|
85
93
|
const unknown = new Map();
|
|
86
|
-
for (const { name, source } of this.collectReferences(
|
|
94
|
+
for (const { name, source } of this.collectReferences(configs)) {
|
|
87
95
|
const id = resolveLucideIconName(name);
|
|
88
96
|
if (id) {
|
|
89
97
|
ids.add(id);
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* whole Lucide set.
|
|
6
6
|
*/
|
|
7
7
|
export declare const ICON_REGISTRY_FILE = "components/layout/IconRegistry.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Project config files, copied to the output directory, whose `icon` entries
|
|
10
|
+
* the registry includes: navigation.json (sidebar) and links.json (footer).
|
|
11
|
+
*/
|
|
12
|
+
export declare const ICON_CONFIG_FILES: readonly string[];
|
|
8
13
|
/** An icon name together with where it was authored, for warnings. */
|
|
9
14
|
export interface IconReference {
|
|
10
15
|
name: string;
|
|
@@ -30,11 +35,12 @@ export declare function resolveLucideIconName(name: string): string | null;
|
|
|
30
35
|
*/
|
|
31
36
|
export declare function collectMdxIconNames(content: string): string[];
|
|
32
37
|
/**
|
|
33
|
-
* Every `icon` string in
|
|
34
|
-
*
|
|
35
|
-
* per-section object form
|
|
38
|
+
* Every `icon` string in a JSON config file, at any depth: the category, link,
|
|
39
|
+
* and nested link-group icons of navigation.json in either the array or the
|
|
40
|
+
* per-section object form, and the footer link icons of links.json. Malformed
|
|
41
|
+
* JSON contributes nothing.
|
|
36
42
|
*/
|
|
37
|
-
export declare function
|
|
43
|
+
export declare function collectConfigIconNames(json: string | null): string[];
|
|
38
44
|
/**
|
|
39
45
|
* Icon names the generated components draw themselves: `<Icon name="...">`
|
|
40
46
|
* literals plus the string literals inside `name={...}` expressions, across
|
|
@@ -6,6 +6,14 @@ import { iconNames } from "lucide-react/dynamic.mjs";
|
|
|
6
6
|
* whole Lucide set.
|
|
7
7
|
*/
|
|
8
8
|
export const ICON_REGISTRY_FILE = "components/layout/IconRegistry.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Project config files, copied to the output directory, whose `icon` entries
|
|
11
|
+
* the registry includes: navigation.json (sidebar) and links.json (footer).
|
|
12
|
+
*/
|
|
13
|
+
export const ICON_CONFIG_FILES = [
|
|
14
|
+
"navigation.json",
|
|
15
|
+
"links.json",
|
|
16
|
+
];
|
|
9
17
|
/** Lucide's kebab-case ids: the canonical spelling every other form resolves to. */
|
|
10
18
|
const KEBAB_IDS = new Set(iconNames);
|
|
11
19
|
/**
|
|
@@ -70,11 +78,12 @@ export function collectMdxIconNames(content) {
|
|
|
70
78
|
];
|
|
71
79
|
}
|
|
72
80
|
/**
|
|
73
|
-
* Every `icon` string in
|
|
74
|
-
*
|
|
75
|
-
* per-section object form
|
|
81
|
+
* Every `icon` string in a JSON config file, at any depth: the category, link,
|
|
82
|
+
* and nested link-group icons of navigation.json in either the array or the
|
|
83
|
+
* per-section object form, and the footer link icons of links.json. Malformed
|
|
84
|
+
* JSON contributes nothing.
|
|
76
85
|
*/
|
|
77
|
-
export function
|
|
86
|
+
export function collectConfigIconNames(json) {
|
|
78
87
|
if (!json)
|
|
79
88
|
return [];
|
|
80
89
|
let parsed;
|
|
@@ -2,6 +2,7 @@ import fs from "fs-extra";
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import chalk from "chalk";
|
|
5
|
+
import { ICON_CONFIG_FILES } from "./lib/icon-registry.js";
|
|
5
6
|
import { rootLayoutTemplate, siteLayoutTemplate } from "./lib/layout.js";
|
|
6
7
|
import { normalizeOpenApiConfig, validateConfig, } from "./lib/config-manager.js";
|
|
7
8
|
import { GeneratedArtifacts, } from "./lib/generated-artifacts.js";
|
|
@@ -330,7 +331,7 @@ export class MDXToNextJSGenerator {
|
|
|
330
331
|
await this.updateRobots();
|
|
331
332
|
await this.updateLlmsFiles();
|
|
332
333
|
}
|
|
333
|
-
if (fileName
|
|
334
|
+
if (ICON_CONFIG_FILES.includes(fileName)) {
|
|
334
335
|
await this.iconRegistryGenerator.refresh();
|
|
335
336
|
}
|
|
336
337
|
}
|
|
@@ -353,7 +354,7 @@ export class MDXToNextJSGenerator {
|
|
|
353
354
|
await this.updateRobots();
|
|
354
355
|
await this.updateLlmsFiles();
|
|
355
356
|
}
|
|
356
|
-
if (fileName
|
|
357
|
+
if (ICON_CONFIG_FILES.includes(fileName)) {
|
|
357
358
|
await this.iconRegistryGenerator.refresh();
|
|
358
359
|
}
|
|
359
360
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doccupine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.158",
|
|
4
4
|
"description": "Free and open-source documentation platform. Write MDX, get a production-ready site with AI chat, built-in components, and an MCP server - in one command.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|