LoginSignup
0
0

More than 1 year has passed since last update.

Typedocを導入する

Last updated at Posted at 2023-04-26

はじめに

こちらの記事に触発されてTypedocを導入しようと思いました。
そちらの導入メモです。

導入

インストール

typedoc-plugin-merge-modulesプラグインも一緒に導入します。

$ yarn add -D typedoc typedoc-plugin-merge-modules

設定

設定ファイル名はいくつか選べますが、今回はプロジェクト全体でESMを使う設定をされていることを前提にtypedoc.config.cjsにします。

typedoc.config.cjs
const { sync } = require('glob');
const { resolve } = require('path');

module.exports = {
  entryPoints: sync(resolve('src/**/*{.js,.ts}')),
  out: 'typedocs/',
  categorizeByGroup: true
};
package.json
{
  ...
  "type": "module"
}

ついでに細かいですが、tscのコンパイル対象から除いておきましょう。

tsconfig.json
{
  ...
  "exclude": [
    ...
    "typedoc.config.cjs"
  ],
}

実行

ver 0.24以降はプラグインの実行のためにCLIのオプション指定が必要です。

$ npx typedoc --plugin typedoc-plugin-merge-modules

参照

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0