Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unstubbable/typedoc-plugin-monorepo
https://github.com/unstubbable/typedoc-plugin-monorepo
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/unstubbable/typedoc-plugin-monorepo
- Owner: unstubbable
- License: mit
- Archived: true
- Fork: true (gprzybylowicz/typedoc-plugin-monorepo)
- Created: 2019-03-15T21:16:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-08T10:33:06.000Z (about 2 years ago)
- Last Synced: 2024-07-21T23:22:07.233Z (4 months ago)
- Language: TypeScript
- Size: 50.8 KB
- Stars: 17
- Watchers: 2
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @strictsoftware/typedoc-plugin-monorepo – DEPRECATED!
**_This project is deprecated since [TypeDoc now supports monorepos out of the box](https://typedoc.org/guides/monorepo/)._**
### What
A plugin for [TypeDoc](http://typedoc.org)
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](https://github.com/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-2In 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 a new input option
```
--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
}
```