Registry / web-framework / builddocs

builddocs

JSON →
library1.0.8jsnpmunverified

Builddocs is a utility designed to transform source code documented with `getdocs-ts`-style comments into HTML documentation. It processes the structured documentation data (typically generated by `getdocs-ts`) and renders it into a final HTML output, leveraging configurable templates and Markdown processing. The current stable version is 1.0.8, indicating a mature and stable codebase for its specific purpose. Unlike comprehensive documentation generators like JSDoc or TypeDoc, Builddocs specializes in the rendering phase, allowing developers to define custom HTML layouts using Mold templating and extend Markdown rendering via `markdown-it`. Its key differentiator lies in its focused approach to consuming `getdocs-ts` output and offering granular control over the final HTML structure and styling, rather than handling the entire parsing-to-rendering lifecycle independently. While a specific release cadence isn't stated, its versioning suggests stability over rapid feature iteration, likely maintained in sync with its primary dependency, `getdocs-ts`.

npm install builddocs
INSTALL
IMPORT
SIG · BUILDDOCS
B
builddocs
web-frameworkjavascriptv1.0.8
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

build
import { build } from 'builddocs'
const build = require('builddocs').build
The primary function for generating documentation; ES Modules preferred.
read
import { read } from 'builddocs'
const { read } = require('builddocs')
Used to explicitly read documentation data using getdocs-ts, typically before passing to `build`.
browserImports
import { browserImports } from 'builddocs'
const browserImports = require('builddocs').browserImports
An object containing common browser type mappings for linking, intended for use with the `imports` or `qualifiedImports` configuration options.

This quickstart demonstrates how to use `builddocs` to generate HTML documentation from a simple JavaScript source file containing `getdocs-ts`-style comments. It configures the build process with a module name, input filename, a basic Markdown template, and options for anchor prefixes and environment variables. The output HTML is written to a temporary file.

import { build } from 'builddocs'; import * as fs from 'fs'; import * as path from 'path'; // Simulate a source file with getdocs-ts comments const sourceCode = ` /** * Represents a point in 2D space. * @class * @property {number} x - The X coordinate. * @property {number} y - The Y coordinate. */ class Point { /** * Creates a new Point instance. * @param {number} x Initial X coordinate. * @param {number} y Initial Y coordinate. */ constructor(x, y) { this.x = x; this.y = y; } /** * Calculates the distance from the origin (0,0). * @returns {number} The distance. */ distance() { return Math.sqrt(this.x ** 2 + this.y ** 2); } } export { Point }; `; const tempDir = path.join(process.cwd(), 'temp-docs'); if (!fs.existsSync(tempDir)) { fs.mkdirSync(tempDir); } const tempSourceFile = path.join(tempDir, 'point.js'); fs.writeFileSync(tempSourceFile, sourceCode); const config = { name: 'GeometryLib', filename: tempSourceFile, mainText: ` # Geometry Library Documentation This document describes the core components of our geometry library. @Point `, anchorPrefix: 'geom.', allowUnresolvedTypes: true, env: { currentDate: new Date().toLocaleDateString() } }; try { const htmlOutput = build(config); const outputFile = path.join(tempDir, 'index.html'); fs.writeFileSync(outputFile, htmlOutput); console.log(`Documentation generated successfully to ${outputFile}`); console.log(`\n--- Generated HTML ---\n${htmlOutput.substring(0, 500)}...`); } catch (error) { console.error('Error generating documentation:', error); } finally { // Clean up temporary files fs.unlinkSync(tempSourceFile); fs.rmdirSync(tempDir); }
builddocs --version
Debug
Known issues
gotchaBy default, `builddocs` will throw an error if it encounters a type name that it cannot resolve (i.e., not defined in the source or explicitly imported via `imports`/`qualifiedImports`).
fix
To prevent errors for unknown types, set the `allowUnresolvedTypes` option to `true` in your configuration object: `{ allowUnresolvedTypes: true }`.
affects: >=1.0.0
gotchaWhen using a custom `main` or `mainText` template, `builddocs` requires that all `@itemName` placeholders in the template exactly match the set of documented items found in the source files. Mismatches will result in an error.
fix
Ensure your template's `@itemName` placeholders correspond precisely to the names of the documented items extracted by `getdocs-ts`. Alternatively, omit the `main` or `mainText` option to let `builddocs` output items in the order they are found without explicit placeholders.
affects: >=1.0.0
gotchaBuilddocs is heavily reliant on the output format of `getdocs-ts`. Changes or incompatibilities in `getdocs-ts`'s JSON output could break builddocs' rendering pipeline.
fix
Always ensure compatibility between `builddocs` and `getdocs-ts` versions. Refer to the respective package documentation and release notes for any breaking changes in `getdocs-ts`'s output structure that might affect `builddocs`.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Unknown type 'MyType' encountered
The documentation source contained a type reference ('MyType') that was not defined in the parsed files nor resolved via the `imports` or `qualifiedImports` configuration options.
fix
Either define 'MyType' in your source code, add it to the `imports` or `qualifiedImports` configuration, or set `allowUnresolvedTypes: true` in your `build` configuration to ignore unknown types.
Error: Template placeholder '@MyItem' does not match any documented item.
The `main` or `mainText` template contained an `@MyItem` placeholder, but no documented item named 'MyItem' was found in the source code.
fix
Correct the placeholder name in your template to match an existing documented item, or ensure the item is correctly documented and parsed by `getdocs-ts`. Remove the placeholder if the item is not intended to be documented.
Error: ENOENT: no such file or directory, open 'path/to/nonexistent-file.js'
The `filename` or `templates` configuration option points to a file or directory that does not exist.
fix
Verify that the paths specified in `filename`, `main`, or `templates` configuration options are correct and accessible from where the `builddocs` command is executed.
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies
getdocs-tsrequiredRequired to parse documentation comments from source code, which builddocs then renders into HTML.
markdown-itrequiredUsed for parsing and rendering Markdown content within documentation comments and templates.
moldrequiredThe templating engine used by builddocs for rendering HTML documentation.
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources