npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@twittwer/compodoc

v1.12.0

Published

[![npm version](https://img.shields.io/npm/v/@twittwer/compodoc?style=flat-square)](https://www.npmjs.com/package/@twittwer/compodoc) [![commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](https://comm

Downloads

14,849

Readme

Compodoc (Nx Plugin)

npm version commitizen friendly styled with prettier

Nx Plugin to generate documentation via Compodoc.
NOTE: The whole generation part is done by @compodoc/compodoc, this is just a wrapper plugin for Nx workspaces.

Getting Started

Add the plugin to your Nx workspace:

npm install --save-dev @twittwer/compodoc

Configure Compodoc for a project:

nx g @twittwer/compodoc:config <project>
# adds a `compodoc` target to the specified project
# ensures `@compodoc/compodoc` as devDependencies

Run nx run <project>:compodoc --serve and go to http://localhost:8080/

Generator

Add Compodoc target to a project:

nx g @twittwer/compodoc:config <project> [options]

| Option | Default | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | | workspaceDocs | false | Will add a "tsconfig.compodoc.json" to the project that includes the whole workspace. Workspace Docs Recipe |

Executor

Generate Compodoc documentation for a project:

# HTML Format
nx run <project>:compodoc
# JSON Format
nx run <project>:compodoc:json

The executor supports several configuration options that are passed to the Compodoc command.
Additional options (used exclusively by the executor) are indicated by an italic written option name.

For more details you may have a look at the original Compodoc documentation or the builder's schema.json

| Option | Default | Description | | ------------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | | tsConfig | <projectRoot>/tsconfig.json | Path to project's tsconfig file. | | outputPath | dist/compodoc/<projectName> | The output path of the generated files. | | exportFormat | html | Format of generated documentation. (html, json - enables Compodoc's minimal mode as well) | | workspaceDocs | false | Use readme of workspace root as entry and add the readme files of all project as additional documentation. | | | | | | name | <projectName> | Title of the documentation. (workspaceDocs uses workspace name as default - defined in package.json) | | | | | | includes | | Path to external markdown files, folder should contain a summary.json. (workspaceDocs will override this) | | includesName | | Name of menu item containing external markdown files. (workspaceDocs uses "Projects" as default) | | | | | | assetsFolder | | External assets folder to copy in generated documentation folder. | | unitTestCoverage | | Path to unit test coverage in json-summary format. | | | | | | disableCoverage | true | Do not add the documentation coverage report. | | disableSourceCode | false | Do not add source code tab and links to source code. | | disableDomTree | false | Do not add dom tree tab. | | disableTemplateTab | false | Do not add template tab. | | disableStyleTab | false | Do not add style tab. | | disableGraph | false | Disable rendering of the dependency graph. | | disablePrivate | true | Do not show private in generated documentation. | | disableProtected | false | Do not show protected in generated documentation. | | disableInternal | true | Do not show @internal in generated documentation. | | disableLifeCycleHooks | true | Do not show Angular lifecycle hooks in generated documentation. | | disableRoutesGraph | false | Do not add the routes graph. | | disableSearch | false | Do not add the search input. | | disableDependencies | false | Do not add the dependencies list. | | | | | | coverageTest | 0 | Threshold for global documentation coverage. | | coverageMinimumPerFile | 0 | Threshold for documentation coverage of each file. | | coverageTestThresholdFail | true | Abort compodoc with an error instead of a warn log, if coverage threshold (global or per file) is not reached (true: error, false: warn). | | | | | | language | en-US | Language used for generated documentation. | | theme | gitbook | Theme used for generated documentation. | | extTheme | | Path to external theme file. | | templates | | Path to directory of Handlebars templates to override built-in templates. | | customLogo | | Path to custom logo. | | customFavicon | | Path to custom favicon. | | hideGenerator | false | Do not print the Compodoc logo at the bottom of the page. | | | | | | serve | false (true in watch mode) | Serve generated documentation. (automatically enabled in watch mode) | | port | 8080 | Port for serving of documentation. | | watch | false | Watch for source files changes to automatically rebuild documentation. | | silent | true (false in watch/serve mode) | Suppress verbose build output. | | | | | | debug | false | Log resulting executor options & the final Compodoc command with all arguments. |

All paths should be relative to workspace root

The target definition can be found in angular.json/workspace.json in the workspace root or project.json in the project directory:

{
  "targets": {
    "compodoc": {
      "executor": "@twittwer/compodoc:compodoc",
      "options": { /* Define your common options here */ },
      "configurations": {
        "<configuration name>": { /* and provide use case specific options via configurations. */ }
      }
    }
  }
}

Recipes

Workspace Docs

Documentation for the whole workspace incl. the README files of all projects (apps/libs) as additional documentation.

  • Create a library for shared/workspace wide tooling (e.g. workspace)
    nx g @nx/workspace:library workspace --unitTestRunner=none
  • Optionally you can delete some unused code (you should keep at least tsconfig.json & README.md).
  • Configure Compodoc for the created project
    nx g @twittwer/compodoc:config workspace --workspaceDocs
  • Generate your docs:
    nx run workspace:compodoc

Watch Mode

Rebuild your documentation on file changes during development.

The watch mode can be activated via argument:

nx run <project>:compodoc --watch # watch mode automatically enables serving
nx run <project>:compodoc:json --watch

or via explicit configuration:

{
  "targets": {
    "compodoc": {
      "executor": "@twittwer/compodoc:compodoc",
      "options": { /* Define your common options here */ },
      "configurations": {
        "serve": { "watch": true }, /* watch mode automatically enables serving */
        "json": { "exportFormat": "json" },
        "json.watch": { "exportFormat": "json", "watch": true }
      }
    }
  }
}

Integration with @nrwl/storybook

At first you have to configure @nrwl/storybook & @twittwer/compodoc for the project.
Wrap storybook & build-storybook targets with a @nx/workspace:run-commands executor:

{
  "targets": {
    "_storybook": { /* @nrwl/storybook */ },
    "_build-storybook": {  /* @nrwl/storybook */ },
    "compodoc": { /* @twittwer/compodoc */ },
    "storybook": {
      "executor": "@nx/workspace:run-commands",
      "options": {
        "commands": [
          "npx nx run <project>:compodoc:json --watch",
          "npx nx run <project>:_storybook"
        ],
        "parallel": true
      },
      "configurations": {
        "build": {
          "commands": [
            "npx nx run <project>:compodoc:json",
            "npx nx run <project>:_build-storybook"
          ],
          "parallel": false
        }
      }
    }
  }
}
{
  "targets": {
    "_storybook": { /* @nrwl/storybook */ },
    "_build-storybook": {  /* @nrwl/storybook */ },
    "compodoc": { /* @twittwer/compodoc */ },
    "storybook": {
      "executor": "@nx/workspace:run-commands",
      "options": {
        "commands": [
          "npx nx run <project>:compodoc:json --watch",
          "npx nx run <project>:_storybook"
        ],
        "parallel": true
      }
    },
    "build-storybook": {
      "executor": "@nx/workspace:run-commands",
      "options": {
        "commands": [
          "npx nx run <project>:compodoc:json",
          "npx nx run <project>:_build-storybook"
        ],
        "parallel": false
      }
    }
  }
}

Configure Storybook Docs in libs/<project>/.storybook/preview.js:

import { setCompodocJson } from '@storybook/addon-docs/angular';
import compodocJson from '../../../dist/compodoc/<project>/documentation.json';

setCompodocJson(compodocJson);

Serve or build it:

# Option 1
nx run <project>:storybook
nx run <project>:storybook:build
# Option 2
nx run <project>:storybook
nx run <project>:build-storybook