@cngxjs/compodocx

中文文档
0.16.1发布于 2026/11/06MITCommonJS构建来源已验证近 30 天下载 2207

Static documentation generator for modern Angular projects — signals, inject(), standalone components, theming tab, JS-based template overrides, Pagefind search.

原始使用文档
文档目录9 节
  1. Why compodocx
  2. Requirements
  3. Install
  4. Quick start
  5. Configuration
  6. Documentation
  7. Development
  8. Acknowledgments
  9. License

compodocx

compodocx

Static documentation generator for modern Angular projects. Reads your TypeScript source, component templates, and (S)CSS, and emits a self-contained HTML site.

CI npm License: MIT

Documentation: compodocx.dev

Why compodocx

The successor to compodoc for modern Angular, not a drop-in replacement. It documents Angular 21+ standalone code (signal inputs, outputs and models, inject(), the structured host metadata, functional guards, interceptors and resolvers) and adds a Theming tab driven by JSDoc/SassDoc-style comments above your CSS / SCSS tokens. The rendering layer is new (JSX templates, Tailwind v4, Pagefind, D3).

NgModules, decorator members (@Input, @Output, @HostBinding, @HostListener), constructor injection in Angular classes and class-based guards, interceptors and resolvers are not documented; a run reports them in one legacy notice. Page URLs and the JSON export schema differ from compodoc. Switching from compodoc means changing the package and the script, running it, and acting on the warnings it prints; MIGRATION.md explains each one.

Requirements

  • Node.js 22 or newer
  • An Angular project with a tsconfig.json (Angular 21+, standalone code; tested against 21 and 22)

Install

npm install --save-dev @cngxjs/compodocx

Inside an Angular workspace, the schematic seeds tsconfig.doc.json, registers npm scripts, and (if you are coming from @compodoc/compodoc) replaces the package and rewrites compodoc scripts in one pass:

ng add @cngxjs/compodocx

Quick start

# Generate static documentation into ./docs
npx compodocx -p tsconfig.app.json -d docs

# Generate, serve, open in browser
npx compodocx -p tsconfig.app.json -d docs -s -o

# Watch + rebuild on every change
npx compodocx -p tsconfig.app.json -d docs -s -w

# Coverage check that fails CI under 70%
npx compodocx -p tsconfig.app.json -d docs --coverageTest 70 --coverageTestThresholdFail

The CLI is also exposed as compodoc, so existing npm scripts keep running.

Configuration

Drop a .compodocxrc.json (or .yaml, .js) into your project root. The older .compodocrc names are still found:

{
    "tsconfig": "./tsconfig.app.json",
    "output": "./docs",
    "theme": "ocean"
}

Full reference for every CLI flag and config key: docs/configuration.md or compodocx.dev/guides/options.

Documentation

TopicFile
Configuration referencedocs/configuration.md
Custom JS template overridesdocs/custom-templates.md
Theme tokens in SCSS / CSSdocs/theming-tokens-authoring-guide.md
Additional Markdown pagesdocs/additional-pages.md
Multi-version outputdocs/versioned-docs.md
JSON export schema historydocs/json-export.md
Internationalizationdocs/i18n.md
Migrating from compodocMIGRATION.md
Releasingdocs/RELEASING.md

Development

git clone https://github.com/cngxjs/compodocx.git
cd compodocx
npm ci
npm run build
npm run test:all
TaskCommand
Unit testsnpm run test:unit
CLI integration testsnpm run test:cli
Playwright e2enpm run test-e2e-playwright
Lint / Formatnpm run lint / npm run format:write

The dev watcher rebuilds the docs site for the standalone fixture whenever a source file changes:

npm run dev          # port 8081

Issues and pull requests welcome at github.com/cngxjs/compodocx.

Acknowledgments

compodocx is a fork of compodoc by Vincent Ogloblinsky and contributors. Its compiler and JSDoc tag handling are the foundation everything here builds on.

License

MIT. See LICENSE.

版本与发布记录

@cngxjs/compodocx 共发布 37 个版本,首次发布于 2026/05/05;过去 12 个月发布了 37 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.16.1latest2026/11/063 天前
0.16.02026/11/063 天前
0.15.02026/11/054 天前
0.14.02026/10/3010 天前
0.13.02026/10/3011 天前
0.12.12026/10/2911 天前

关于 @cngxjs/compodocx 的常见问题

@cngxjs/compodocx 是什么?

Static documentation generator for modern Angular projects — signals, inject(), standalone components, theming tab, JS-based template overrides, Pagefind search.

如何安装 @cngxjs/compodocx?

在项目目录运行 npm install @cngxjs/compodocx,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 compodoc、compodocx,可以用 npx compodoc 直接运行。

@cngxjs/compodocx 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cngxjs__compodocx 是否存在。

@cngxjs/compodocx 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@cngxjs/compodocx 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cngxjs/compodocx 可以商用吗?

@cngxjs/compodocx 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cngxjs/compodocx 的下载量有多少?

根据 npm 官方下载统计,@cngxjs/compodocx 在 2026/10/10 – 2026/11/08 这 30 天内被下载 2,207 次,日均约 74 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cngxjs/compodocx 还在维护吗?

最新版本 0.16.1 发布于 2026/11/06(3 天前);至今共发布 37 个版本,其中过去 12 个月发布了 37 个;首次发布于 2026/05/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。