@docubook/docs-tree
v1.0.1
Published
Prebuild navigation tree for DocuBook documentation
Downloads
1,507
Maintainers
Readme
@docubook/docs-tree
Prebuild navigation tree for DocuBook documentation.
Installation
npm
npm install --save-dev @docubook/docs-treepnpm
pnpm add -D @docubook/docs-treeyarn
yarn add -D @docubook/docs-treebun
bun add -d @docubook/docs-treeUsage
npm
npx @docubook/docs-tree ./docs ./docu.json ./lib/docs-tree.jsonpnpm
pnpm dlx @docubook/docs-tree ./docs ./docu.json ./lib/docs-tree.jsonyarn
yarn dlx @docubook/docs-tree ./docs ./docu.json ./lib/docs-tree.jsonbun
bunx @docubook/docs-tree ./docs ./docu.json ./lib/docs-tree.jsonOr run with default paths:
npx @docubook/docs-tree # Uses ./docs, ./docu.json, ./docs-tree.jsonImplementation in DocuBook Projects
Add to your package.json scripts:
{
"scripts": {
"prebuild": "pnpm dlx @docubook/docs-tree ./docs ./docu.json ./lib/docs-tree.json",
"build": "pnpm run prebuild && next build"
}
}Import in your routes file:
// lib/route.ts
import docsTree from "@/lib/docs-tree.json";
export const ROUTES = docsTree;The navigation tree will be prebuilt before each production build, with intelligent caching to skip regeneration when no changes are detected.
