bin/gen-docs
bin/gen-docs.js
Functions(19)
Signature
parseArgs(argv: any): any
Resolves a project's own entry points (bin/main/exports) from the
package.json in the current working directory, if any. Used to keep
findOrphanFiles from flagging a project's own public entry points.
Returns:
string[] — absolute file paths, deduplicated.Signature
resolveEntryPoints(): any
Runs code-multivitals + the import-graph analysis for embedding into the
doc site. Applies baseline/snapshot side effects (these are meaningful
regardless of embedded vs. standalone mode) before returning the data
buildSite() needs.
| Parameter | Type | Optional | Description |
|---|---|---|---|
files | string[] | ||
cliArgs | object |
Returns:
{result: object, graph: object, orphans: string[], snapshots?: object[]} Signature
computeQualityEmbedData(files: any, cliArgs: any): any
Handles the standalone/export --quality-reporter modes (console, json,
sarif, badge, html, dashboard) -- entirely separate from the doc-site
build, same contract as the original design. Only invoked when the user
explicitly passes --quality-reporter; the plain `--quality` case is
handled by computeQualityEmbedData() + the normal build() call instead.
| Parameter | Type | Optional | Description |
|---|---|---|---|
files | string[] | ||
cliArgs | object | ||
outDir | string |
Returns:
boolean — true (always handles the run when called).Signature
runQualityStandalone(files: any, cliArgs: any, outDir: any): any
Signature
resolveTitle(titleArg: any): any
Signature
collectAllFiles(inputs: any, ignorePatterns: any): any
| Parameter | Type | Optional | Description |
|---|---|---|---|
modules | any | ||
projectName | any | ||
version | any | ||
outDir | any |
Returns:
any Signature
generateReadme(modules: any, projectName: any, version: any, outDir: any): any
Signature
row(kind: any, item: any, sig: any): any
story-doc-version-switcher: extracts the version-id out of a
`site-data-history/site-data-<id>.json` filename. Pure string-parse of
the ISO-timestamp (dashes standing in for colons/dot) `writeSiteData()`
(lib/site-data.js) already generates -- no new convention invented, and
this never needs to change if that convention doesn't.
a "-1"-style collision suffix in the rare case two writes landed in the
same millisecond).
| Parameter | Type | Optional | Description |
|---|---|---|---|
historyFilePath | string | - a `site-data-history/*.json` path or bare filename. |
Returns:
string — the version-id (e.g. "2026-07-01T14-22-03-123Z", or withSignature
deriveVersionId(historyFilePath: any): any
story-doc-version-switcher: lists existing `site-versions/<id>/`
directories, most-recent-first. Version-ids are fixed-width ISO-timestamp
strings (dashes for colons/dot), so a plain reverse lexical sort is
chronological too, without needing to re-parse each into a Date here --
`lib/renderer.js`'s `buildVersionSwitcher()`/`formatVersionLabel()` does
that parsing purely for display, this function only enumerates ids.
| Parameter | Type | Optional | Description |
|---|---|---|---|
outDir | string |
Returns:
string[] Signature
listVersionSnapshots(outDir: any): any
story-doc-version-switcher (TICKET-2): renders ONE historical
`site-data-*.json` into its own `<outDir>/site-versions/<versionId>/`
snapshot -- a complete, self-contained copy of the site as it looked at
that generation (requirement 2/5). Reuses `writeSite()` verbatim (no new
render path): `versionOpts` tells that call this is a snapshot render,
not the live/main run, so it skips re-writing its own site-data.json/
history/backfill (that would recurse and pollute every historical
snapshot with a nested copy of the data layer, which isn't part of "a
complete copy of the site" per requirement 2's own listed contents --
index.html/modules/assets/health-detail pages, not docs.json/README/
site-data.json). `docs.json`/`README.md` are likewise switched off for
snapshot renders for the same reason -- kept minimal and focused on the
browsable site itself, not duplicated once per historical generation.
| Parameter | Type | Optional | Description |
|---|---|---|---|
dataPath | string | - the `site-data-*.json` file to render. | |
outDir | string | - the LIVE output root (site-versions/ is created under this). | |
versionId | string | ||
opts | object | ||
versions | string[] | - full version-id list (for that snapshot's own switcher). | |
silent | boolean |
Returns:
boolean — true if rendered, false if the source JSON couldn't be read.Signature
renderVersionSnapshot(dataPath: any, outDir: any, versionId: any, opts: any, versions: any, silent: any): any
story-doc-version-switcher (TICKET-3): render-only-missing backfill.
`site-data-history/*.json` entries are immutable once moved there (Phase
L Decision 5) -- once a version-id's snapshot exists, re-rendering it has
zero correctness benefit and is pure wasted cost at realistic history
depth (solutions-architect's estimate: O(1) per run after a one-time
backfill, see the story's architect sign-off). `fs.existsSync` on the
target directory is the entire "already rendered" check.
| Parameter | Type | Optional | Description |
|---|---|---|---|
outDir | string | ||
opts | object | ||
silent | boolean |
Signature
renderMissingVersionSnapshots(outDir: any, opts: any, silent: any)
Writes the full site (+ optional docs.json / README.md / site-data.json)
from an already-in-hand `modules` array. Split out from `build()` so
`--from-data` (story-file-detail-redesign) can reuse this exact same
write path without re-parsing source files -- `modules` there comes from
a saved site-data.json instead of `extractModule()`.
story-doc-version-switcher: set by `renderVersionSnapshot()` when this call is
rendering ONE historical snapshot rather than the live/main site. `null`/omitted
means "this is the live/main run" -- compute everything fresh below.
| Parameter | Type | Optional | Description |
|---|---|---|---|
modules | object[] | ||
outDir | string | ||
projectName | string | ||
projectVersion | string | ||
opts | object | ||
silent | boolean | ||
qualityData | object|null | ||
versionOpts | {isSnapshot: boolean, currentVersionId: string, versions: string[]}|null | - |
Returns:
number — pages written.Signature
writeSite(modules: any, outDir: any, projectName: any, projectVersion: any, opts: any, silent: any, qualityData: any, versionOpts: any): any
| Parameter | Type | Optional | Description |
|---|---|---|---|
files | any | ||
outDir | any | ||
projectName | any | ||
projectVersion | any | ||
opts | any | ||
silent | any | ||
qualityData | any |
Returns:
any Signature
build(files: any, outDir: any, projectName: any, projectVersion: any, opts: any, silent: any, qualityData: any): any
Variables & Constants(95)
const { buildSite, moduleLabel, moduleHtmlPath }: any
constSignature
const { buildSite, moduleLabel, moduleHtmlPath }: anySignature
const { loadConfig, mergeConfig }: anySignature
const { buildImportGraph, findOrphanFiles }: any