Skip to content

Commit

Permalink
Merge branch 'typedoc-0.25-update'
Browse files Browse the repository at this point in the history
  • Loading branch information
krisztianb committed Aug 30, 2023
2 parents 2a062b9 + d3e70e8 commit 1f11cbc
Show file tree
Hide file tree
Showing 15 changed files with 600 additions and 602 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@
"@typescript-eslint/explicit-member-accessibility": ["error"],
"@typescript-eslint/no-confusing-non-null-assertion": ["error"],
"@typescript-eslint/no-extraneous-class": ["error"],
"@typescript-eslint/no-implicit-any-catch": ["error"],
"@typescript-eslint/no-invalid-void-type": ["error"],
"@typescript-eslint/no-parameter-properties": ["error"],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": ["error"],
"@typescript-eslint/no-unnecessary-condition": ["error"],
"@typescript-eslint/no-unnecessary-qualifier": ["error"],
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [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.
Expand Down Expand Up @@ -69,7 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

First release

[unreleased]: https://github.com/krisztianb/typedoc-plugin-merge-modules/compare/v5.0.1...HEAD
[unreleased]: https://github.com/krisztianb/typedoc-plugin-merge-modules/compare/v5.1.0...HEAD
[5.1.0]: https://github.com/krisztianb/typedoc-plugin-merge-modules/releases/tag/v5.1.0
[5.0.1]: https://github.com/krisztianb/typedoc-plugin-merge-modules/releases/tag/v5.0.1
[5.0.0]: https://github.com/krisztianb/typedoc-plugin-merge-modules/releases/tag/v5.0.0
[4.1.0]: https://github.com/krisztianb/typedoc-plugin-merge-modules/releases/tag/v4.1.0
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ This module can be installed using [npm](https://www.npmjs.com/package/typedoc-p
$ npm install typedoc-plugin-merge-modules --save-dev
```

The plugin requires TypeDoc version 0.24.x to be installed. After installation you need to activate the plugin with a [typedoc command line argument](https://typedoc.org/options/configuration/#plugin) or inside your [typedoc config file](https://typedoc.org/options/configuration/#json-files).
The plugin requires TypeDoc version 0.24.x or 0.25.x to be installed. After installation you need to activate the plugin with a [typedoc command line argument](https://typedoc.org/options/configuration/#plugin) or inside your [typedoc config file](https://typedoc.org/options/configuration/#json-files).

Here is an example using a JavaScript config file:

```js
/** @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.

Expand Down
893 changes: 386 additions & 507 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typedoc-plugin-merge-modules",
"version": "5.0.1",
"version": "5.1.0",
"description": "Plugin for TypeDoc that merges the content of modules.",
"author": {
"name": "Krisztián Balla",
Expand All @@ -13,21 +13,21 @@
],
"devDependencies": {
"@types/mocha": "10.0.1",
"@types/node": "14.18.0",
"@typescript-eslint/eslint-plugin": "5.59.7",
"@typescript-eslint/parser": "5.59.7",
"@types/node": "18.16.20",
"@typescript-eslint/eslint-plugin": "6.5.0",
"@typescript-eslint/parser": "6.5.0",
"cypress": "12.13.0",
"eslint": "8.41.0",
"eslint-plugin-jsdoc": "44.2.7",
"eslint": "8.48.0",
"eslint-plugin-jsdoc": "46.5.1",
"eslint-plugin-ordered-imports": "0.6.0",
"eslint-plugin-unicorn": "47.0.0",
"prettier": "2.8.8",
"eslint-plugin-unicorn": "48.0.1",
"prettier": "3.0.3",
"rimraf": "5.0.1",
"typedoc": "0.24.7",
"typescript": "5.0.4"
"typedoc": "0.25.0",
"typescript": "5.2.2"
},
"peerDependencies": {
"typedoc": "0.24.x"
"typedoc": "0.24.x || 0.25.x"
},
"repository": {
"type": "git",
Expand All @@ -42,6 +42,6 @@
"lint": "eslint ./src ./test",
"format": "prettier --check ./src ./test",
"build": "rimraf dist && tsc",
"test": "cd test && test.bat"
"test": "cd test && node test.js"
}
}
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { Application } from "typedoc";
import { Plugin } from "./plugin";
import { PluginConfig } from "./plugin_options";

/**
* Type that can be intersected with TypeDoc's config type to have static type checking for the plugin's configuration.
* Check out the README.md for an example.
*/
export type Config = PluginConfig;

/**
* Initializes the plugin.
Expand Down
1 change: 0 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export class Plugin {
ReflectionKind.ClassOrInterface |
ReflectionKind.Enum |
ReflectionKind.Function |
ReflectionKind.ObjectLiteral |
ReflectionKind.TypeAlias |
ReflectionKind.TypeLiteral |
ReflectionKind.Variable,
Expand Down
16 changes: 12 additions & 4 deletions src/plugin_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ type Mode = "project" | "module" | "module-category" | "off";
*/
declare module "typedoc" {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- This is not a separate type.
export interface TypeDocOptionMap {
mergeModulesRenameDefaults: boolean;
mergeModulesMergeMode: Mode;
}
export interface TypeDocOptionMap extends Required<PluginConfig> {}
}

/**
* A type for the options of the plugin.
*/
export type PluginConfig = {
/** Defines if the plugin should rename default exports to their original name. */
mergeModulesRenameDefaults?: boolean;

/** Defines how the plugin should merge modules. */
mergeModulesMergeMode?: Mode;
};

/**
* Class storing the options of the plugin.
*/
Expand Down
46 changes: 38 additions & 8 deletions test/merge-module-category/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,54 @@ describe("index.html", () => {
cy.visit("./merge-module-category/output/index.html");
});

it("contains a separate module and class link for the class E which has no @module jsdoc tag", () => {
it("contains a separate module link for the class E which has no @module jsdoc tag", () => {
cy.get("nav").find("a[href='modules/e.html']");
cy.get("nav").find("a[href='classes/e.E.html']");
});

it("contains 3 merged module links", () => {
cy.get("nav").find("a[href='modules/merged.html']"); // for A & B
cy.get("nav").find("a[href='modules/merged-1.html']"); // for C
cy.get("nav").find("a[href='modules/merged-2.html']"); // for D
});
});

describe("modules/e.html", () => {
beforeEach(() => {
cy.visit("./merge-module-category/output/modules/e.html");
});

it("contains a sub link to the class E", () => {
cy.get("nav").find("a[href='../classes/e.E.html']");
});
});

describe("modules/merged.html", () => {
beforeEach(() => {
cy.visit("./merge-module-category/output/modules/merged.html");
});

it("merged the modules of A and B", () => {
cy.get("nav").find("a[href='classes/merged.A.html']");
cy.get("nav").find("a[href='classes/merged.B.html']");
it("contains sub links to the classes A and B", () => {
cy.get("nav").find("a[href='../classes/merged.A.html']");
cy.get("nav").find("a[href='../classes/merged.B.html']");
});
});

describe("modules/merged-1.html", () => {
beforeEach(() => {
cy.visit("./merge-module-category/output/modules/merged-1.html");
});

it("contains a sub link to the class C", () => {
cy.get("nav").find("a[href='../classes/merged-1.C.html']");
});
});

describe("modules/merged-2.html", () => {
beforeEach(() => {
cy.visit("./merge-module-category/output/modules/merged-2.html");
});

it("didn't merge the modules of C and D", () => {
cy.get("nav").find("a[href='classes/merged-1.C.html']");
cy.get("nav").find("a[href='classes/merged-2.D.html']");
it("contains a sub link to the class D", () => {
cy.get("nav").find("a[href='../classes/merged-2.D.html']");
});
});
12 changes: 6 additions & 6 deletions test/merge-module-monorepo/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ describe("index.html", () => {
it("contains a module link for 'Project 1'", () => {
cy.get("nav").find("a[href='modules/Project_1.html']");
});

it("contains sub links to the classes A, B and C", () => {
cy.get("nav").find("a[href='classes/Project_1.A.html']");
cy.get("nav").find("a[href='classes/Project_1.B.html']");
cy.get("nav").find("a[href='classes/Project_1.C.html']");
});
});

describe("modules/Project_1.html", () => {
beforeEach(() => {
cy.visit("./merge-module-monorepo/output/modules/Project_1.html");
});

it("contains sub links to the classes A, B and C", () => {
cy.get("nav").find("a[href='../classes/Project_1.A.html']");
cy.get("nav").find("a[href='../classes/Project_1.B.html']");
cy.get("nav").find("a[href='../classes/Project_1.C.html']");
});

it("contains index links to the classes A, B and C", () => {
cy.get(".col-content .tsd-index-list").find("a[href='../classes/Project_1.A.html']");
cy.get(".col-content .tsd-index-list").find("a[href='../classes/Project_1.B.html']");
Expand Down
23 changes: 19 additions & 4 deletions test/merge-module/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@ describe("index.html", () => {
it("contains a merged module link for a and b", () => {
cy.get("nav").find("a[href='modules/merged.html']");
});
});

describe("modules/c.html", () => {
beforeEach(() => {
cy.visit("./merge-module/output/modules/c.html");
});

it("contains a sub link to the class C", () => {
cy.get("nav").find("a[href='../classes/c.C.html']");
});
});

describe("modules/merged.html", () => {
beforeEach(() => {
cy.visit("./merge-module/output/modules/merged.html");
});

it("contains sub links to the classes A, B and C", () => {
cy.get("nav").find("a[href='classes/merged.A.html']");
cy.get("nav").find("a[href='classes/merged.B.html']");
cy.get("nav").find("a[href='classes/c.C.html']");
it("contains sub links to the classes A and B", () => {
cy.get("nav").find("a[href='../classes/merged.A.html']");
cy.get("nav").find("a[href='../classes/merged.B.html']");
});
});
32 changes: 28 additions & 4 deletions test/merge-off/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,34 @@ describe("index.html", () => {
cy.get("nav").find("a[href='modules/b.html']");
cy.get("nav").find("a[href='modules/c.html']");
});
});

describe("modules/a.html", () => {
beforeEach(() => {
cy.visit("./merge-off/output/modules/a.html");
});

it("contains a sub link to the class A", () => {
cy.get("nav").find("a[href='../classes/a.A.html']");
});
});

describe("modules/b.html", () => {
beforeEach(() => {
cy.visit("./merge-off/output/modules/b.html");
});

it("contains a sub link to the class B", () => {
cy.get("nav").find("a[href='../classes/b.B.html']");
});
});

describe("modules/c.html", () => {
beforeEach(() => {
cy.visit("./merge-off/output/modules/c.html");
});

it("contains sub links to the classes A, B and C", () => {
cy.get("nav").find("a[href='classes/a.A.html']");
cy.get("nav").find("a[href='classes/b.B.html']");
cy.get("nav").find("a[href='classes/c.C.html']");
it("contains a sub link to the class C", () => {
cy.get("nav").find("a[href='../classes/c.C.html']");
});
});
47 changes: 0 additions & 47 deletions test/test.bat

This file was deleted.

Loading

0 comments on commit 1f11cbc

Please sign in to comment.