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

@mshipov/typedoc-plugin-monorepo

v0.2.2

Published

Optimize Typedoc documentation output for libraries that are organized in a monorepo.

Downloads

8

Readme

@strictsoftware/typedoc-plugin-monorepo

What

A plugin for TypeDoc

When trying to unify documentation for multiple modules residing inside a shared source repository, the default way TypeDoc assignes top-level module names might not satisfy.

This plugin allows you to specify a regular expression with a capture group. This is then used to collect related items into one module.

This plugin is inspired by, and based on, asgerjensen/typedoc-plugin-external-module-map. However, this plugin will automagically rename top-level modules discovered to a new "Package" type, and auto-discover and display READMEs for the individual packages. Furthermore, these packages are used as top-level entries in the table of contents.

This plugin is intended for monorepos that deliver more than one NPM package in a single Git repository.

Suppose you have

packages/@namespace/package-1/index.ts
packages/@namespace/package-1/src/otherfiles.ts
packages/@namespace/package-2/index.ts
packages/@namespace/package-2/src/otherfiles.ts

TypeDoc will create four "Modules", named for each .ts file.

  • "@namespace/package-1/index"
  • "@namespace/package-1/src/otherfiles"
  • "@namespace/package-2/index"
  • "@namespace/package-2/src/otherfiles"

This plugin allows each file to specify the TypeDoc Module its code should belong to. If multiple files belong to the same module, they are merged.

This allows more control over the modules that TypeDoc generates. Instead of the four modules above, we could group them into two:

  • @namespace/package-1
  • @namespace/package-2

In addition to grouping these modules, the plugin will attempt to discover README files in each module root to display with the documented package. In this plugin, top-level typedoc "modules" are renamed to the more semantic name "packages" in generated documentation.

Installing

TypeDoc >=0.11 has the ability to discover and load typedoc plugins found in node_modules. Simply install the plugin and run typedoc.

npm install --save @strictsoftware/typedoc-plugin-monorepo
typedoc

Using

This plugin adds some new options

--external-modulemap

--external-modulemap  ".*packages\/(@namespace\/[^\/]+)\/.*"

If you specify it from the command line, be sure to escape the input string so bash doesn't expand it.

It is probably easier to create a typedoc options file (typedoc.json) and add it there:

{
  "name": "My Library",
  "out": "doc",
  "theme": "default",
  "preserveConstEnums": "true",
  "exclude": "*.spec.ts",
  "external-modulemap": ".*packages\/(@namespace\/[^\/]+)\/.*",
  "excludeExternals": false
}

--inline-references

Replace references with actual target declarations in output project symbols. This is required when re-exports with same name are presented in project files because this will lead to collisions in output symbols map and references links would target to nowhere.