Skip to main content
All scripts are defined in package.json and run via npm run <script>.

Scripts overview

ScriptCommandDescription
generate-docsnode generate-md.mjsRun TypeDoc to generate Markdown from webpack’s type definitions
build-htmldoc-kit generate ...Convert the generated Markdown to HTML
buildgenerate-docs + build-htmlFull pipeline: Markdown generation then HTML output
linteslint .Check all files for ESLint violations
lint:fixeslint --fix .Auto-fix ESLint violations where possible
formatprettier --write .Format all files with Prettier
format:checkprettier --check .Verify formatting without making changes
preparehuskyInstall git hooks — runs automatically on npm install

Documentation scripts

generate-docs

Invokes generate-md.mjs, which uses TypeDoc with custom plugins to read webpack’s type definitions and emit Markdown files into the pages/ directory.
npm run generate-docs
This script requires a webpack/ directory to be present at the repository root (checked out at the commit pinned in HEAD_COMMIT).

build-html

Passes the generated Markdown through @node-core/doc-kit to produce static HTML in the out/ directory.
npm run build-html
The full doc-kit invocation:
doc-kit generate -t web -i ./pages/v5.x/**/*.md --type-map ./pages/v5.x/type-map.json -o out
FlagValuePurpose
-twebTarget format
-i./pages/v5.x/**/*.mdInput Markdown glob
--type-map./pages/v5.x/type-map.jsonCross-reference type map generated by the processor plugin
-ooutOutput directory

build

Runs generate-docs followed by build-html in sequence — the complete pipeline from source types to deployable HTML.
npm run build
Run npm run build before pushing to catch any doc-generation or HTML-build failures locally, before CI does.

Linting and formatting scripts

lint and lint:fix

ESLint is configured in eslint.config.mjs using @eslint/js recommended rules targeting Node.js globals. The node_modules/, out/, and webpack/ directories are excluded.
npm run lint

format and format:check

Prettier handles formatting. The following paths are excluded via .prettierignore: node_modules, out, *.generated.*, /webpack, pages, and .husky.
npm run format

Pre-commit hook: husky + lint-staged

prepare

prepare runs automatically whenever you run npm install. You do not need to call it manually after cloning the repository.
Husky installs a pre-commit git hook defined in .husky/pre-commit:
npx lint-staged

lint-staged configuration

.lintstagedrc defines which tools run against staged files before each commit:
{
  "**/*.{js,mjs,ts,tsx,md,mdx,json.yml}": [
    "eslint --fix",
    "prettier --check --write"
  ]
}
On every git commit, lint-staged runs ESLint (with auto-fix) and Prettier (check then write) against all staged files matching js, mjs, ts, tsx, md, mdx, json, or yml. Staged changes are updated automatically if fixes are applied.

Build docs developers (and LLMs) love