Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

typedoc-plugin-merge-modules

krisztianb121.9kISC6.1.0TypeScript support: included

Plugin for TypeDoc that merges the content of modules.

typedoc-plugin, typedocplugin

readme

NPM Version Donate

typedoc-plugin-merge-modules

This is a plugin for TypeDoc that merges the content of modules.

Use cases:

  • If you want to document an entire application and not a library, you can specify all files that you want to have documented as entry points for TypeDoc and use this plugin to merge all modules into the project root removing the extra module layer.
  • If you want to merge the content of some modules in the TypeDoc output, you can use this plugin and module annotations in your files to specify which modules should be combined.

Example

Here is an example of how the navigation menu of TypeDoc's output changes when merging all modules into the project root using the plugin:

Example

Installation

This module can be installed using npm:

$ npm install typedoc-plugin-merge-modules --save-dev

The plugin requires TypeDoc version 0.26.0 or above to be installed. After installation you need to activate the plugin with a typedoc command line argument or inside your typedoc config file.

Here is an example using a JavaScript config file:

/** @type { import('typedoc').TypeDocOptionMap & import('typedoc-plugin-merge-modules').Config } */
module.exports = {
    out: "output",
    entryPointStrategy: "expand",
    entryPoints: ["input/module1.ts", "input/module2.ts"],
    tsconfig: "tsconfig.json",
    readme: "MAIN.md",
    plugin: ["typedoc-plugin-merge-modules"],
    mergeModulesRenameDefaults: true, // NEW option of TypeDoc added by this plugin
    mergeModulesMergeMode: "project", // NEW option of TypeDoc added by this plugin
};

After installation TypeDoc can be used normally and you can configure this plugin as described below.

Options

The following options are added to TypeDoc when the plugin is installed:

Name & Format Description Default
mergeModulesRenameDefaults <boolean> Defines if the plugin should rename default exports to their original name. true
mergeModulesMergeMode <"project"|"module"|"module-category"|"off"> Defines how the plugin should merge modules:

  • "project" = The plugin merges the content of all modules into the project root.
  • "module" = The plugin merges modules with the same name. By default the filename is the module name, which you can overwrite using module comments.
  • "module-category" = Same as "module" but will only merge modules that have the same category.
  • "off" = Disables the plugin.
"project"

When you set mergeModulesMergeMode to "module" OR "module-category" in combination with module comments you should add the tag @mergeTarget to the comment of the module whose comment should be used in the merge result.

Bugs

Please report bugs here. Thanks for your contribution!

Credits

Special thanks go to the following people that contributed to this project:

If you find this piece of software helpful, please consider a donation. Any amount is greatly appreciated.

Donate

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

6.1.0 - 2024-11-30

Added

  • Added support for latest TypeDoc version 0.27.x.

6.0.3 - 2024-10-25

Fixed

  • Category descriptions and group descriptions were missing when merging into the project root.

6.0.2 - 2024-10-13

Fixed

  • Category descriptions and group descriptions were missing in the generated documentation when TypeDoc was run with an entryPointStrategy different than "merge" or "packages".

6.0.1 - 2024-09-22

Fixed

  • Project documentations (introduced in TypeDoc 0.26) were incorrectly handled and removed by the plugin.
  • Merging only happened at the root level and didn't take into account that TypeDoc creates parent modules for projects within monorepos.

6.0.0 - 2024-06-30

BREAKING CHANGES

  • Support changed to TypeDoc version 0.26.x due to a breaking change in TypeDoc's API.

5.1.0 - 2023-08-30

Added

  • Added support for latest TypeDoc version 0.25.x.
  • The plugin now includes typings for its configuation that you can use in your TypeDoc config. (see README)

5.0.1 - 2023-05-27

Fixed

  • Categories and groups are incomplete when merging modules in a monorepo project.

5.0.0 - 2023-05-01

BREAKING CHANGES

  • Support changed to TypeDoc versions 0.24.x due to a breaking change in TypeDoc's API.

    Fixed

  • Monorepos were not merged correctly in version 4.1.0

4.1.0 - 2023-04-23

Changes

  • Added support for latest TypeDoc version 0.24.x.

4.0.1 - 2022-07-09

Fixed

  • Plugin doesn't rename certain types of default exports.

4.0.0 - 2022-07-03

BREAKING CHANGES

  • Support changed to TypeDoc versions 0.23.x due to a breaking change in TypeDoc's API.

    Added

  • Option mergeModulesMergeMode now has a new value module-category to merge modules with the same name but only if they are within the same category.

    Fixed

  • Renaming of default exports now also works for: enums, object literals, type literals and type aliases.

3.1.0 - 2021-12-08

Added

  • When merging modules by name you can use the comment tag @mergeTarget to define the module into which the other modules with the same name should be merged. The comment of this module is used in the resulting module.

3.0.2 - 2021-09-18

Added

  • Add support for TypeDoc version 0.22.

3.0.1 - 2021-08-08

Fixed

  • Plugin doesn't rename default exports of type interface.

3.0.0 - 2021-07-18

BREAKING CHANGES

  • Support changed to TypeDoc versions >=0.21.0 due to a breaking change in TypeDoc's API.

2.1.1 - 2021-06-07

Fixed

  • Plugin would rename default exports when setting option mergeModulesMergeMode to off.

2.1.0 - 2021-06-06

Added

  • New option mergeModulesMergeMode to merge by module names or to turn the plugin off.

2.0.0 - 2021-03-13

BREAKING CHANGES

  • New option mergeModulesRenameDefaults is true by default.

    Added

  • New option mergeModulesRenameDefaults to rename default exports.

1.0.0 - 2021-01-30

First release