@docubook/flame 1.4.4 → 1.5.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.
- package/.docu/lib/build.deno.js +11 -0
- package/.docu/lib/build.impl-ST63VRTV.js +12 -0
- package/.docu/lib/build.node.js +10 -0
- package/.docu/lib/chunk-2QHMGZIL.js +2419 -0
- package/.docu/lib/chunk-654THQOR.js +461 -0
- package/.docu/lib/chunk-C6RZ2KBH.js +79 -0
- package/.docu/lib/chunk-HH4YXWEF.js +300 -0
- package/.docu/lib/chunk-J5NMYSBJ.js +59 -0
- package/.docu/lib/chunk-RE4NGTMT.js +185 -0
- package/.docu/lib/chunk-X6GYOIYZ.js +383 -0
- package/.docu/lib/chunk-ZOWTASXL.js +92 -0
- package/.docu/lib/clean.js +32 -0
- package/.docu/lib/deploy.deno.js +13 -0
- package/.docu/lib/deploy.node.js +10 -0
- package/.docu/lib/preview.deno.js +10 -0
- package/.docu/lib/preview.node.js +10 -0
- package/.docu/lib/server.deno.js +11 -0
- package/.docu/lib/server.node.js +11 -0
- package/.docu/node/build-summary.ts +126 -0
- package/.docu/node/build.deno.ts +7 -0
- package/.docu/node/build.impl.ts +424 -0
- package/.docu/node/build.node.ts +3 -0
- package/.docu/node/deploy.deno.ts +11 -0
- package/.docu/node/deploy.node.ts +6 -0
- package/.docu/node/deploy.shared.ts +85 -0
- package/.docu/node/deploy.ts +11 -0
- package/.docu/node/escapeHtml.ts +18 -0
- package/.docu/node/git.ts +79 -0
- package/.docu/node/html.shared.ts +110 -0
- package/.docu/node/hydrate.node.ts +287 -0
- package/.docu/node/hydrate.ts +16 -19
- package/.docu/node/mdx.ts +1 -1
- package/.docu/node/paths.ts +24 -0
- package/.docu/node/plugin-builder.ts +6 -2
- package/.docu/node/plugin.ts +11 -2
- package/.docu/node/preview.deno.ts +4 -0
- package/.docu/node/preview.impl.ts +96 -0
- package/.docu/node/preview.node.ts +4 -0
- package/.docu/node/security.ts +5 -0
- package/.docu/node/server-routes.ts +4 -4
- package/.docu/node/server.deno.ts +4 -0
- package/.docu/node/server.impl.ts +184 -0
- package/.docu/node/server.node.ts +4 -0
- package/.docu/styles/globals.css +20 -5
- package/README.md +57 -506
- package/bin/cli.js +89 -14
- package/bin/compile-lib.mjs +67 -0
- package/package.json +9 -5
- package/template/docs/getting-started/configuration.mdx +18 -0
- package/template/docs/getting-started/overview.mdx +50 -0
- package/template/docs/guide/deployment.mdx +27 -0
- package/template/docs/guide/routing.mdx +25 -0
- package/template/docs/index.mdx +8 -205
- package/template/docu.json +32 -1
package/bin/cli.js
CHANGED
|
@@ -1,18 +1,46 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
/* global process, console */
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* global process, console, Bun, Deno */
|
|
3
3
|
|
|
4
4
|
import { resolve, join } from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
5
6
|
import { cpSync, existsSync, readFileSync, writeFileSync, renameSync } from "node:fs";
|
|
7
|
+
import { spawnSync } from "node:child_process";
|
|
6
8
|
|
|
7
9
|
const __dirname = import.meta.dirname;
|
|
8
10
|
|
|
11
|
+
// Runtime detection — override with FLAME_RUNTIME=bun|node|deno for testing.
|
|
12
|
+
const runtime =
|
|
13
|
+
process.env.FLAME_RUNTIME ||
|
|
14
|
+
(typeof Bun !== "undefined" ? "bun" : typeof Deno !== "undefined" ? "deno" : "node");
|
|
15
|
+
|
|
9
16
|
const COMMAND_MAP = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
bun: {
|
|
18
|
+
dev: "server.ts",
|
|
19
|
+
build: "build.ts",
|
|
20
|
+
clean: "clean.ts",
|
|
21
|
+
preview: "preview.ts",
|
|
22
|
+
deploy: "deploy.ts",
|
|
23
|
+
},
|
|
24
|
+
node: {
|
|
25
|
+
dev: "server.node.ts",
|
|
26
|
+
build: "build.node.ts",
|
|
27
|
+
clean: "clean.ts",
|
|
28
|
+
preview: "preview.node.ts",
|
|
29
|
+
deploy: "deploy.node.ts",
|
|
30
|
+
},
|
|
31
|
+
deno: {
|
|
32
|
+
dev: "server.deno.ts",
|
|
33
|
+
build: "build.deno.ts",
|
|
34
|
+
clean: "clean.ts",
|
|
35
|
+
preview: "preview.deno.ts",
|
|
36
|
+
deploy: "deploy.deno.ts",
|
|
37
|
+
},
|
|
38
|
+
}[runtime];
|
|
39
|
+
|
|
40
|
+
if (!COMMAND_MAP) {
|
|
41
|
+
console.error(`Unknown runtime: "${process.env.FLAME_RUNTIME}" (expected bun, node, or deno)`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
16
44
|
|
|
17
45
|
const command = process.argv[2];
|
|
18
46
|
|
|
@@ -24,7 +52,7 @@ if (themeIndex !== -1 && themeIndex + 1 < process.argv.length) {
|
|
|
24
52
|
|
|
25
53
|
if (!command || command === "--help" || command === "-h") {
|
|
26
54
|
console.log(`
|
|
27
|
-
@docubook/flame — A blazing-fast React + MDX framework
|
|
55
|
+
@docubook/flame — A blazing-fast React + MDX framework for modern documentation experiences. Runs on Bun, Node.js, and Deno.
|
|
28
56
|
|
|
29
57
|
Usage: flame <command>
|
|
30
58
|
|
|
@@ -70,9 +98,24 @@ if (command === "init") {
|
|
|
70
98
|
const flamePkg = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf-8"));
|
|
71
99
|
pkg.dependencies = pkg.dependencies || {};
|
|
72
100
|
pkg.dependencies["@docubook/flame"] = `^${flamePkg.version}`;
|
|
101
|
+
if (runtime === "deno") {
|
|
102
|
+
// Deno has no node_modules/.bin — tasks must call flame via npm: specifier.
|
|
103
|
+
const flameCmd = "deno run -A npm:@docubook/flame";
|
|
104
|
+
pkg.scripts = {
|
|
105
|
+
dev: `${flameCmd} dev`,
|
|
106
|
+
build: `${flameCmd} build`,
|
|
107
|
+
preview: `${flameCmd} preview`,
|
|
108
|
+
deploy: `${flameCmd} deploy`,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
73
111
|
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
74
112
|
|
|
75
|
-
|
|
113
|
+
const nextSteps = {
|
|
114
|
+
bun: " bun install\n bun run dev",
|
|
115
|
+
node: " npm install\n npm run dev",
|
|
116
|
+
deno: " deno task dev",
|
|
117
|
+
}[runtime];
|
|
118
|
+
console.log(`\n ✓ Project scaffolded!\n\n Next steps:\n${nextSteps}\n`);
|
|
76
119
|
process.exit(0);
|
|
77
120
|
} catch (err) {
|
|
78
121
|
console.error(`Failed to scaffold project: ${err.message}`);
|
|
@@ -85,7 +128,39 @@ if (!(command in COMMAND_MAP)) {
|
|
|
85
128
|
process.exit(1);
|
|
86
129
|
}
|
|
87
130
|
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
131
|
+
const sourceFile = COMMAND_MAP[command];
|
|
132
|
+
const packageRoot = resolve(__dirname, "..");
|
|
133
|
+
const nodePath = join(packageRoot, ".docu/node", sourceFile);
|
|
134
|
+
const libPath = join(packageRoot, ".docu/lib", sourceFile.replace(/\.ts$/, ".js"));
|
|
135
|
+
|
|
136
|
+
// Bun executes TypeScript sources directly; Node and Deno use the
|
|
137
|
+
// precompiled JS in .docu/lib, generated at publish. In a monorepo clone
|
|
138
|
+
// .docu/lib is gitignored, so compile it lazily — the entry graph imports
|
|
139
|
+
// .tsx sources that Node cannot load.
|
|
140
|
+
if (runtime !== "bun" && !existsSync(libPath) && existsSync(nodePath)) {
|
|
141
|
+
console.log("flame: .docu/lib missing — precompiling entry points...");
|
|
142
|
+
const compileScript = join(__dirname, "compile-lib.mjs");
|
|
143
|
+
const result = spawnSync(
|
|
144
|
+
process.execPath,
|
|
145
|
+
typeof Deno === "undefined" ? [compileScript] : ["run", "-A", compileScript],
|
|
146
|
+
{ cwd: packageRoot, stdio: "inherit" }
|
|
147
|
+
);
|
|
148
|
+
if (result.status !== 0) {
|
|
149
|
+
console.error(
|
|
150
|
+
result.error
|
|
151
|
+
? `flame: failed to run compile-lib.mjs: ${result.error.message}`
|
|
152
|
+
: "flame: failed to precompile .docu/lib (see output above)."
|
|
153
|
+
);
|
|
154
|
+
process.exit(result.status ?? 1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const scriptPath =
|
|
159
|
+
runtime === "bun"
|
|
160
|
+
? existsSync(nodePath)
|
|
161
|
+
? nodePath
|
|
162
|
+
: libPath
|
|
163
|
+
: existsSync(libPath)
|
|
164
|
+
? libPath
|
|
165
|
+
: nodePath;
|
|
166
|
+
await import(pathToFileURL(scriptPath).href);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Precompile the Node/Deno entry points to plain ESM JavaScript in
|
|
4
|
+
* `.docu/lib/`. Node cannot import `.ts`/`.tsx` sources and Deno does not
|
|
5
|
+
* execute TypeScript inside npm packages, so the published package ships
|
|
6
|
+
* this compiled tree alongside the Bun-executed TypeScript in `.docu/node/`.
|
|
7
|
+
* The CLI routes non-Bun runtimes here (see `bin/cli.js`).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { rmSync } from "node:fs";
|
|
11
|
+
import { build, stop } from "esbuild";
|
|
12
|
+
|
|
13
|
+
const ENTRIES = [
|
|
14
|
+
"server.node.ts",
|
|
15
|
+
"server.deno.ts",
|
|
16
|
+
"build.node.ts",
|
|
17
|
+
"build.deno.ts",
|
|
18
|
+
"preview.node.ts",
|
|
19
|
+
"preview.deno.ts",
|
|
20
|
+
"deploy.node.ts",
|
|
21
|
+
"deploy.deno.ts",
|
|
22
|
+
"clean.ts",
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
rmSync(".docu/lib", { recursive: true, force: true });
|
|
26
|
+
|
|
27
|
+
await build({
|
|
28
|
+
entryPoints: ENTRIES.map((entry) => `.docu/node/${entry}`),
|
|
29
|
+
outdir: ".docu/lib",
|
|
30
|
+
bundle: true,
|
|
31
|
+
splitting: true,
|
|
32
|
+
format: "esm",
|
|
33
|
+
platform: "node",
|
|
34
|
+
target: "node20",
|
|
35
|
+
packages: "external",
|
|
36
|
+
jsx: "automatic",
|
|
37
|
+
logLevel: "info",
|
|
38
|
+
plugins: [
|
|
39
|
+
{
|
|
40
|
+
// The SSR component graph imports `docu.json` statically
|
|
41
|
+
// (client-routes.ts). At runtime that must be the USER's project
|
|
42
|
+
// config, so replace the import with a cwd-relative read instead of
|
|
43
|
+
// baking the monorepo's docu.json into the published bundle.
|
|
44
|
+
name: "docu-config-runtime",
|
|
45
|
+
setup(build) {
|
|
46
|
+
build.onResolve({ filter: /docu\.json$/ }, (args) => ({
|
|
47
|
+
path: args.path,
|
|
48
|
+
namespace: "docu-config-runtime",
|
|
49
|
+
}));
|
|
50
|
+
build.onLoad({ filter: /.*/, namespace: "docu-config-runtime" }, () => ({
|
|
51
|
+
contents: [
|
|
52
|
+
`import { readFileSync } from "node:fs";`,
|
|
53
|
+
`import { join } from "node:path";`,
|
|
54
|
+
`const config = JSON.parse(readFileSync(join(process.cwd(), "docu.json"), "utf-8"));`,
|
|
55
|
+
`export default config;`,
|
|
56
|
+
].join("\n"),
|
|
57
|
+
loader: "js",
|
|
58
|
+
}));
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// esbuild's service process keeps Deno's event loop alive after one-shot
|
|
65
|
+
// build() calls — stop it explicitly so `flame` can invoke this script
|
|
66
|
+
// under Deno. Harmless under Node.
|
|
67
|
+
await stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docubook/flame",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "A blazing-fast React + MDX framework powered by Bun, built for modern documentation experiences.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
|
+
"node": ">=20.11",
|
|
25
26
|
"bun": ">=1.1.0"
|
|
26
27
|
},
|
|
27
28
|
"keywords": [
|
|
@@ -48,14 +49,16 @@
|
|
|
48
49
|
"@tailwindcss/typography": "0.5.16",
|
|
49
50
|
"bun-plugin-tailwind": "^0.1.2",
|
|
50
51
|
"daisyui": "^5.5.19",
|
|
52
|
+
"esbuild": "^0.28.1",
|
|
51
53
|
"lucide-react": "^1.14.0",
|
|
52
54
|
"react": "^19.2.7",
|
|
53
55
|
"react-dom": "^19.2.7",
|
|
54
56
|
"unified": "^11.0.0",
|
|
55
|
-
"@docubook/
|
|
56
|
-
"@docubook/mdx-content": "^3.4.
|
|
57
|
-
"@docubook/
|
|
58
|
-
"@docubook/themes-colors": "^0.
|
|
57
|
+
"@docubook/core": "^1.8.1",
|
|
58
|
+
"@docubook/mdx-content": "^3.4.2",
|
|
59
|
+
"@docubook/runt": "^1.0.0",
|
|
60
|
+
"@docubook/themes-colors": "^1.0.0",
|
|
61
|
+
"@docubook/ui-react": "^1.0.0"
|
|
59
62
|
},
|
|
60
63
|
"peerDependencies": {
|
|
61
64
|
"@sentry/bun": "^10.0.0"
|
|
@@ -87,6 +90,7 @@
|
|
|
87
90
|
"clean": "bun .docu/node/clean.ts",
|
|
88
91
|
"preview": "bun .docu/node/preview.ts",
|
|
89
92
|
"deploy": "bun .docu/node/deploy.ts",
|
|
93
|
+
"compile:lib": "node bin/compile-lib.mjs",
|
|
90
94
|
"test": "vitest run",
|
|
91
95
|
"lint": "eslint ."
|
|
92
96
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration
|
|
3
|
+
description: docu.json reference — meta, navbar, themes, routes, and plugins.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`docu.json` in your project root controls the site. Key sections:
|
|
7
|
+
|
|
8
|
+
| Field | Description |
|
|
9
|
+
|---|---|
|
|
10
|
+
| `meta` | Site title, description, favicon, base URL |
|
|
11
|
+
| `navbar` | Logo, navigation menu links |
|
|
12
|
+
| `home.hero` | Landing page hero with tagline, headline, actions |
|
|
13
|
+
| `home.features` | Feature cards with icon, title, description |
|
|
14
|
+
| `routes` | Sidebar navigation (auto-detected from `docs/` when empty) |
|
|
15
|
+
| `themes` | Colour preset or custom palette |
|
|
16
|
+
| `plugins` | Build/dev pipeline extensions |
|
|
17
|
+
|
|
18
|
+
See this site's `docu.json` for a complete example, or refer to `docu.schema.json` in the package root.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Quick Start
|
|
3
|
+
description: Get your first documentation site running on Bun, Node.js, or Deno.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Prerequisites
|
|
7
|
+
|
|
8
|
+
Choose **one** runtime:
|
|
9
|
+
|
|
10
|
+
- **Bun** >= 1.1: `curl -fsSL https://bun.sh/install | bash`
|
|
11
|
+
- **Node.js** >= 20.11: [nodejs.org](https://nodejs.org)
|
|
12
|
+
- **Deno** >= 2.x: `curl -fsSL https://deno.land/install.sh | sh`
|
|
13
|
+
|
|
14
|
+
## Create a project
|
|
15
|
+
|
|
16
|
+
<Tabs>
|
|
17
|
+
<Tab title="Bun">
|
|
18
|
+
```bash
|
|
19
|
+
mkdir my-docs && cd my-docs
|
|
20
|
+
bun add @docubook/flame
|
|
21
|
+
bunx flame init
|
|
22
|
+
bun run dev
|
|
23
|
+
```
|
|
24
|
+
</Tab>
|
|
25
|
+
<Tab title="Node.js">
|
|
26
|
+
```bash
|
|
27
|
+
mkdir my-docs && cd my-docs
|
|
28
|
+
npm install @docubook/flame
|
|
29
|
+
npx flame init
|
|
30
|
+
npm run dev
|
|
31
|
+
```
|
|
32
|
+
</Tab>
|
|
33
|
+
<Tab title="Deno">
|
|
34
|
+
```bash
|
|
35
|
+
mkdir my-docs && cd my-docs
|
|
36
|
+
deno run -A npm:@docubook/flame init
|
|
37
|
+
deno task dev
|
|
38
|
+
```
|
|
39
|
+
</Tab>
|
|
40
|
+
</Tabs>
|
|
41
|
+
|
|
42
|
+
Open http://localhost:3000 — changes to `docs/` or `docu.json` hot-reload.
|
|
43
|
+
|
|
44
|
+
## Build for production
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm run build # or: bun run build / deno task build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Static output goes to `.docu/dist/` — deploy to any CDN or static host.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deployment
|
|
3
|
+
description: Deploy your Flame site to any static host.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Flame produces **flat static HTML** — no server, no database, no runtime required. Deploy the output of `.docu/dist/` to any CDN or static host.
|
|
7
|
+
|
|
8
|
+
## GitHub Pages
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm run deploy
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This builds the site, adds `.nojekyll`, and generates a GitHub Actions workflow on first run.
|
|
15
|
+
|
|
16
|
+
## Manual
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm run build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Upload `.docu/dist/` to any of:
|
|
23
|
+
|
|
24
|
+
- **Vercel** — drop the folder or connect your repo
|
|
25
|
+
- **Netlify** — publish directory: `.docu/dist`
|
|
26
|
+
- **Cloudflare Pages** — output directory: `.docu/dist`
|
|
27
|
+
- **S3 / GCS / Azure** — sync and serve via CDN
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Routing
|
|
3
|
+
description: How Flame maps MDX files to static HTML pages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Flame uses **filesystem-based routing** — every `.mdx` file in `docs/` compiles to a matching `.html` path:
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
docs/
|
|
10
|
+
├── index.mdx → /docs/index.html
|
|
11
|
+
├── getting-started/
|
|
12
|
+
│ ├── overview.mdx → /docs/getting-started/overview.html
|
|
13
|
+
│ └── configuration.mdx → /docs/getting-started/configuration.html
|
|
14
|
+
└── guide/
|
|
15
|
+
├── components.mdx → /docs/guide/components.html
|
|
16
|
+
└── routing.mdx → /docs/guide/routing.html
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Auto-routing
|
|
20
|
+
|
|
21
|
+
When `routes: []` in `docu.json`, Flame automatically scans `docs/` at build time and generates the sidebar from the directory structure.
|
|
22
|
+
|
|
23
|
+
## Manual routes
|
|
24
|
+
|
|
25
|
+
Define `routes` in `docu.json` for a custom sidebar. Add `context` groups with icons for multi-section documentation. See this project's `docu.json` for examples.
|
package/template/docs/index.mdx
CHANGED
|
@@ -1,212 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: DocuBook Flame 🔥
|
|
3
|
-
description:
|
|
4
|
-
date: 2026-05-24
|
|
3
|
+
description: An open-source alternative to Mintlify or GitBook — MDX-powered documentation, static HTML output.
|
|
5
4
|
---
|
|
6
5
|
|
|
7
|
-
**@docubook/flame** is a
|
|
6
|
+
**@docubook/flame** is a static site generator for documentation. Write in MDX, compile to flat static HTML — no server required. Runs on **Bun**, **Node.js**, and **Deno**.
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- **Bun-native** — instant startup, native TypeScript, fast builds
|
|
16
|
-
- **React-first** — JSX/TSX, hooks, component composition
|
|
17
|
-
- **MDX content** — write Markdown with embedded React components
|
|
18
|
-
- **Filesystem routing** — auto-detect routes from `docs/` folder
|
|
19
|
-
- **Lightweight SSR** — React server-side rendering without a heavy framework
|
|
20
|
-
- **Client hydration** — interactive islands for sidebar, TOC, and MDX components
|
|
21
|
-
- **HMR** — instant reload on docs changes during development
|
|
22
|
-
- **Static build** — pre-render all pages to static HTML for deployment
|
|
23
|
-
|
|
24
|
-
## Quick Start
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
mkdir my-docs && cd my-docs
|
|
28
|
-
bun add @docubook/flame
|
|
29
|
-
bunx flame init
|
|
30
|
-
bun run dev
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Project Structure
|
|
34
|
-
|
|
35
|
-
After `flame init`, your project looks like:
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
my-docs/
|
|
39
|
-
├── docs/ # Your MDX content
|
|
40
|
-
│ └── index.mdx # Home page
|
|
41
|
-
├── docu.json # Site configuration (navbar, routes, meta)
|
|
42
|
-
├── package.json # Dependencies
|
|
43
|
-
└── .docu/
|
|
44
|
-
└── dist/ # Build output (after `bun run build`)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Commands
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
bun run dev # Start dev server with HMR
|
|
51
|
-
bun run build # Static build to .docu/dist/
|
|
52
|
-
bun run preview # Serve built output locally
|
|
53
|
-
bun run deploy # Build + prepare for GitHub Pages
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Configuration
|
|
57
|
-
|
|
58
|
-
`docu.json` controls your site:
|
|
59
|
-
|
|
60
|
-
```json
|
|
61
|
-
{
|
|
62
|
-
"meta": {
|
|
63
|
-
"title": "My Docs",
|
|
64
|
-
"description": "Documentation powered by DocuBook Flame"
|
|
65
|
-
},
|
|
66
|
-
"navbar": {
|
|
67
|
-
"logoText": "My Docs",
|
|
68
|
-
"menu": [
|
|
69
|
-
{ "title": "Home", "href": "/" },
|
|
70
|
-
{ "title": "Docs", "href": "/docs" }
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
|
-
"routes": []
|
|
74
|
-
}
|
|
8
|
+
```mermaid
|
|
9
|
+
flowchart LR
|
|
10
|
+
A[Your .mdx content] --> B[flame build]
|
|
11
|
+
B --> C[Static HTML + assets]
|
|
12
|
+
C --> D[Vercel / Netlify / GitHub Pages / S3]
|
|
75
13
|
```
|
|
76
14
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
When `routes` is an empty array `[]`, Flame automatically scans your `docs/` folder at build-time and generates the sidebar navigation from the directory structure. Folders become collapsible sections, and `.mdx`/`.md` files become links — sorted alphabetically.
|
|
80
|
-
|
|
81
|
-
To define navigation manually, populate the `routes` array:
|
|
82
|
-
|
|
83
|
-
```json
|
|
84
|
-
{
|
|
85
|
-
"routes": [
|
|
86
|
-
{
|
|
87
|
-
"title": "Getting Started",
|
|
88
|
-
"href": "/getting-started",
|
|
89
|
-
"noLink": true,
|
|
90
|
-
"context": {
|
|
91
|
-
"icon": "BookOpen",
|
|
92
|
-
"title": "Guides",
|
|
93
|
-
"description": "Set up your Documentation"
|
|
94
|
-
},
|
|
95
|
-
"items": [
|
|
96
|
-
{ "title": "Introduction", "href": "/introduction" },
|
|
97
|
-
{ "title": "Installation", "href": "/installation" }
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
> Manual routes take priority — if `routes` has entries, folder scanning is skipped entirely.
|
|
105
|
-
|
|
106
|
-
## Routing
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
docs/
|
|
110
|
-
├── index.mdx → /docs
|
|
111
|
-
├── getting-started/
|
|
112
|
-
│ ├── introduction.mdx → /docs/getting-started/introduction
|
|
113
|
-
│ └── installation.mdx → /docs/getting-started/installation
|
|
114
|
-
└── components/
|
|
115
|
-
├── button.mdx → /docs/components/button
|
|
116
|
-
└── card.mdx → /docs/components/card
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Assets
|
|
120
|
-
|
|
121
|
-
Place images and static files in `docs/assets/`. They are copied to the build output and accessible at `/docs/assets/`.
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
docs/
|
|
125
|
-
├── assets/
|
|
126
|
-
│ └── images/
|
|
127
|
-
│ ├── logo.svg
|
|
128
|
-
│ └── screenshot.png
|
|
129
|
-
└── getting-started/
|
|
130
|
-
└── introduction.mdx
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Reference in MDX:
|
|
134
|
-
|
|
135
|
-
```markdown
|
|
136
|
-

|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
> The `docs/assets/` directory is excluded from route scanning — files inside it won't appear in the sidebar.
|
|
140
|
-
|
|
141
|
-
## Architecture
|
|
142
|
-
|
|
143
|
-
- **Bun** — runtime, bundler, file watcher
|
|
144
|
-
- **React + React DOM** — rendering (SSR + client hydration)
|
|
145
|
-
- **@docubook/core** — MDX compilation, rehype/remark plugins
|
|
146
|
-
- **@docubook/mdx-content** — pre-built MDX components
|
|
147
|
-
- **Tailwind CSS + daisyUI** — styling
|
|
148
|
-
|
|
149
|
-
## Comparison
|
|
150
|
-
|
|
151
|
-
| Framework | Runtime | UI | Approach |
|
|
152
|
-
| ------------------- | ------- | --------- | --------------------------- |
|
|
153
|
-
| Docusaurus | Node.js | React | Full-featured, plugin-heavy |
|
|
154
|
-
| VitePress | Node.js | Vue | Lightweight, Vue-only |
|
|
155
|
-
| Nextra | Node.js | React | Next.js-based |
|
|
156
|
-
| **@docubook/flame** | **Bun** | **React** | **Minimal, Bun-native SSR** |
|
|
157
|
-
|
|
158
|
-
## Deployment
|
|
159
|
-
|
|
160
|
-
### GitHub Pages
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
bun run deploy
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
This will:
|
|
167
|
-
|
|
168
|
-
1. Run production build → output to `.docu/dist/`
|
|
169
|
-
2. Add `.nojekyll` file
|
|
170
|
-
3. Generate `.github/workflows/deploy.yml` (first run only)
|
|
171
|
-
|
|
172
|
-
Then push to GitHub and enable Pages: **Settings → Pages → Source: GitHub Actions**
|
|
173
|
-
|
|
174
|
-
### Manual / Other Hosts
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
bun run build
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Upload the contents of `.docu/dist/` to any static hosting (Netlify, Cloudflare Pages, Vercel, S3, etc).
|
|
181
|
-
|
|
182
|
-
## Environment Variables
|
|
183
|
-
|
|
184
|
-
Copy `.env.example` to `.env` to customize:
|
|
185
|
-
|
|
186
|
-
```
|
|
187
|
-
# Server port (default: 3000)
|
|
188
|
-
PORT=3000
|
|
189
|
-
|
|
190
|
-
# Error Monitoring (optional)
|
|
191
|
-
SENTRY_DSN=https://your-dsn@sentry.io/project-id
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
## Error Monitoring (Optional)
|
|
195
|
-
|
|
196
|
-
Flame has built-in [Sentry](https://sentry.io) support for error tracking. To enable:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
bun add @sentry/bun
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
Then set environment variables:
|
|
203
|
-
|
|
204
|
-
```
|
|
205
|
-
SENTRY_DSN=https://your-dsn@sentry.io/project-id
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Errors during dev server and build will be automatically captured. No configuration needed beyond the DSN.
|
|
209
|
-
|
|
210
|
-
## Requirements
|
|
211
|
-
|
|
212
|
-
- [Bun](https://bun.sh) >= 1.1.0
|
|
15
|
+
Check the sidebar for guides on getting started, configuration, components, routing, and deployment.
|
package/template/docu.json
CHANGED
|
@@ -74,5 +74,36 @@
|
|
|
74
74
|
"path": "blob/main/{filePath}",
|
|
75
75
|
"edit": false
|
|
76
76
|
},
|
|
77
|
-
"
|
|
77
|
+
"sidebar": {
|
|
78
|
+
"context": "dropdown"
|
|
79
|
+
},
|
|
80
|
+
"routes": [
|
|
81
|
+
{
|
|
82
|
+
"title": "Getting Started",
|
|
83
|
+
"href": "/getting-started",
|
|
84
|
+
"noLink": true,
|
|
85
|
+
"context": {
|
|
86
|
+
"icon": "Rocket",
|
|
87
|
+
"title": "Getting Started"
|
|
88
|
+
},
|
|
89
|
+
"items": [
|
|
90
|
+
{ "title": "Overview", "href": "/overview" },
|
|
91
|
+
{ "title": "Configuration", "href": "/configuration" }
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"title": "Guide",
|
|
96
|
+
"href": "/guide",
|
|
97
|
+
"noLink": true,
|
|
98
|
+
"context": {
|
|
99
|
+
"icon": "BookOpen",
|
|
100
|
+
"title": "Guide"
|
|
101
|
+
},
|
|
102
|
+
"items": [
|
|
103
|
+
{ "title": "Components", "href": "/components" },
|
|
104
|
+
{ "title": "Routing", "href": "/routing" },
|
|
105
|
+
{ "title": "Deployment", "href": "/deployment" }
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
78
109
|
}
|