Skip to content

Commit

Permalink
Merge branch 'GH-22-support-typedoc-0.27'
Browse files Browse the repository at this point in the history
  • Loading branch information
krisztianb committed Nov 30, 2024
2 parents 120293a + 349349d commit 465b2dc
Show file tree
Hide file tree
Showing 21 changed files with 1,040 additions and 1,810 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [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.
Expand Down Expand Up @@ -92,7 +96,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/v6.0.3...HEAD
[unreleased]: https://github.com/krisztianb/typedoc-plugin-merge-modules/compare/v6.1.0...HEAD
[6.1.0]: https://github.com/krisztianb/typedoc-plugin-merge-modules/releases/tag/v6.1.0
[6.0.3]: https://github.com/krisztianb/typedoc-plugin-merge-modules/releases/tag/v6.0.3
[6.0.2]: https://github.com/krisztianb/typedoc-plugin-merge-modules/releases/tag/v6.0.2
[6.0.1]: https://github.com/krisztianb/typedoc-plugin-merge-modules/releases/tag/v6.0.1
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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.26.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.26.0 or above 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:

Expand Down Expand Up @@ -66,6 +66,7 @@ Special thanks go to the following people that contributed to this project:
- [Gerrit Birkeland](https://github.com/Gerrit0) for the suggested solution and code example.
- [Felipe Santos](https://github.com/felipecrs) for suggesting improvements.
- [Sho Otani](https://github.com/beijaflor) for implementing the merging of modules by name.
- And all the other [contributors](https://github.com/krisztianb/typedoc-plugin-merge-modules/graphs/contributors).

## Donate

Expand Down
2,666 changes: 946 additions & 1,720 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "typedoc-plugin-merge-modules",
"version": "6.0.3",
"version": "6.1.0",
"type": "module",
"description": "Plugin for TypeDoc that merges the content of modules.",
"author": {
"name": "Krisztián Balla",
Expand All @@ -15,18 +16,18 @@
"@types/node": "20.14.9",
"@typescript-eslint/eslint-plugin": "7.14.1",
"@typescript-eslint/parser": "7.14.1",
"cypress": "13.14.2",
"cypress": "13.16.0",
"eslint": "8.56.0",
"eslint-plugin-jsdoc": "48.5.0",
"eslint-plugin-ordered-imports": "0.6.0",
"eslint-plugin-unicorn": "54.0.0",
"prettier": "3.3.3",
"prettier": "3.4.1",
"rimraf": "6.0.1",
"typedoc": "0.26.7",
"typescript": "5.5.4"
"typedoc": "0.27.2",
"typescript": "5.6.3"
},
"peerDependencies": {
"typedoc": "0.26.x"
"typedoc": "0.26.x || ^0.27.1"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Application } from "typedoc";
import { Plugin } from "./plugin";
import { PluginConfig } from "./plugin_options";
import type { Application } from "typedoc";
import { Plugin } from "./plugin.js";
import type { PluginConfig } from "./plugin_options.js";

/**
* Type that can be intersected with TypeDoc's config type to have static type checking for the plugin's configuration.
Expand Down
4 changes: 2 additions & 2 deletions src/merger/module_bundle.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Comment, DeclarationReflection, DocumentReflection, ProjectReflection, ReflectionKind } from "typedoc";
import { Comment, DeclarationReflection, DocumentReflection, type ProjectReflection, ReflectionKind } from "typedoc";
import {
getNameFromDescriptionTag,
moveDeclarationReflectionToTarget,
moveDocumentReflectionToTarget,
removeTagFromCommentsOf,
} from "../utils";
} from "../utils.js";

/**
* Name of the comment tag that can be used to mark a module as the target module within the bundle.
Expand Down
4 changes: 2 additions & 2 deletions src/merger/module_category_merger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DeclarationReflection } from "typedoc";
import { ModuleMerger } from "./module_merger";
import type { DeclarationReflection } from "typedoc";
import { ModuleMerger } from "./module_merger.js";

/**
* Merger that merges the content of modules based on their JSDoc module annotation and category.
Expand Down
8 changes: 4 additions & 4 deletions src/merger/module_merger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Plugin } from "src/plugin";
import { DeclarationReflection, ProjectReflection } from "typedoc";
import { getModulesFrom } from "../utils";
import { ModuleBundle } from "./module_bundle";
import type { Plugin } from "src/plugin.js";
import type { DeclarationReflection, ProjectReflection } from "typedoc";
import { getModulesFrom } from "../utils.js";
import { ModuleBundle } from "./module_bundle.js";

/**
* Merger that merges the content of modules based on their JSDoc module annotation.
Expand Down
8 changes: 4 additions & 4 deletions src/merger/project_merger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ProjectReflection } from "typedoc";
import { Plugin } from "../plugin";
import { getModulesFrom } from "../utils";
import { ModuleBundle } from "./module_bundle";
import type { ProjectReflection } from "typedoc";
import type { Plugin } from "../plugin.js";
import { getModulesFrom } from "../utils.js";
import { ModuleBundle } from "./module_bundle.js";

/**
* Merger that moves the content of all modules into the project root.
Expand Down
16 changes: 8 additions & 8 deletions src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
Application,
Context,
type Context,
Converter,
DeclarationReflection,
type DeclarationReflection,
EntryPointStrategy,
ProjectReflection,
type ProjectReflection,
ReflectionKind,
} from "typedoc";
import { ModuleCategoryMerger } from "./merger/module_category_merger";
import { ModuleMerger } from "./merger/module_merger";
import { ProjectMerger } from "./merger/project_merger";
import { PluginOptions } from "./plugin_options";
import { tryGetOriginalReflectionName } from "./utils";
import { ModuleCategoryMerger } from "./merger/module_category_merger.js";
import { ModuleMerger } from "./merger/module_merger.js";
import { ProjectMerger } from "./merger/project_merger.js";
import { PluginOptions } from "./plugin_options.js";
import { tryGetOriginalReflectionName } from "./utils.js";

/**
* The "Merge Modules" plugin.
Expand Down
2 changes: 1 addition & 1 deletion src/plugin_options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Application, ParameterType } from "typedoc";
import { type Application, ParameterType } from "typedoc";

/** Type for the plugin's mode. */
type Mode = "project" | "module" | "module-category" | "off";
Expand Down
10 changes: 5 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
CommentTag,
Context,
type CommentTag,
type Context,
DeclarationReflection,
DocumentReflection,
ProjectReflection,
type DocumentReflection,
type ProjectReflection,
ReflectionKind,
} from "typedoc";
import * as ts from "typescript";
import type * as ts from "typescript";

/**
* Type extending the TypeScript Declaration interface with a possible identifier object as a name.
Expand Down
7 changes: 4 additions & 3 deletions test/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/unbound-method
const { defineConfig } = require("cypress");
import { defineConfig } from "cypress";

module.exports = defineConfig({
const config = defineConfig({
e2e: {
specPattern: "**/*.cy.ts",
supportFile: false,
video: false,
screenshotOnRunFailure: false,
},
});

export default config;
4 changes: 2 additions & 2 deletions test/merge-module-category/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe("modules/merged-1.html", () => {
});

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

Expand All @@ -56,6 +56,6 @@ describe("modules/merged-2.html", () => {
});

it("contains a sub link to the class D", () => {
cy.get("nav").find("a[href='../classes/merged-2.D.html']");
cy.get("nav").find("a[href='../classes/merged.D.html']");
});
});
18 changes: 9 additions & 9 deletions test/merge-module-monorepo/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,29 @@ describe("modules/Project_2.merged.html", () => {
});

it("contains index links to the classes A, B and C", () => {
cy.get(".col-content .tsd-index-list").find("a[href='../classes/Project_2.merged.A.html']");
cy.get(".col-content .tsd-index-list").find("a[href='../classes/Project_2.merged.B.html']");
cy.get(".col-content .tsd-index-list").find("a[href='../classes/Project_2.merged.C.html']");
cy.get(".col-content .tsd-member-summaries").find("a[href='../classes/Project_2.merged.A.html']");
cy.get(".col-content .tsd-member-summaries").find("a[href='../classes/Project_2.merged.B.html']");
cy.get(".col-content .tsd-member-summaries").find("a[href='../classes/Project_2.merged.C.html']");
});

it("contains the category Alpha and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(2)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(2)";

cy.get(sectionSelector + " h3").should("have.text", "Alpha");
cy.get(sectionSelector + " h2").should("contain", "Alpha");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of A.");
});

it("contains the category Beta and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(3)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(3)";

cy.get(sectionSelector + " h3").should("have.text", "Beta");
cy.get(sectionSelector + " h2").should("contain", "Beta");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of B.");
});

it("contains the category Gamma and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(1)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(1)";

cy.get(sectionSelector + " h3").should("have.text", "Gamma");
cy.get(sectionSelector + " h2").should("contain", "Gamma");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of C.");
});
});
12 changes: 6 additions & 6 deletions test/merge-module/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ describe("modules/notMerged.html", () => {
});

it("contains the category Gamma and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(1)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(1)";

cy.get(sectionSelector + " h3").should("have.text", "Gamma");
cy.get(sectionSelector + " h2").should("contain", "Gamma");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of C.");
});
});
Expand All @@ -50,16 +50,16 @@ describe("modules/merged.html", () => {
});

it("contains the category Alpha and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(1)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(1)";

cy.get(sectionSelector + " h3").should("have.text", "Alpha");
cy.get(sectionSelector + " h2").should("contain", "Alpha");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of A.");
});

it("contains the category Beta and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(2)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(2)";

cy.get(sectionSelector + " h3").should("have.text", "Beta");
cy.get(sectionSelector + " h2").should("contain", "Beta");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of B.");
});
});
12 changes: 6 additions & 6 deletions test/merge-project-monorepo/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ describe("modules.html", () => {
});

it("contains the category Alpha and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(1)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(1)";

cy.get(sectionSelector + " h3").should("have.text", "Alpha");
cy.get(sectionSelector + " h2").should("contain", "Alpha");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of A.");
});

it("contains the category Beta and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(2)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(2)";

cy.get(sectionSelector + " h3").should("have.text", "Beta");
cy.get(sectionSelector + " h2").should("contain", "Beta");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of B.");
});

it("contains the category Gamma and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(3)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(3)";

cy.get(sectionSelector + " h3").should("have.text", "Gamma");
cy.get(sectionSelector + " h2").should("contain", "Gamma");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of C.");
});
});
12 changes: 6 additions & 6 deletions test/merge-project/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ describe("modules.html", () => {
});

it("contains the category Alpha and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(1)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(1)";

cy.get(sectionSelector + " h3").should("have.text", "Alpha");
cy.get(sectionSelector + " h2").should("contain", "Alpha");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of A.");
});

it("contains the category Beta and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(2)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(2)";

cy.get(sectionSelector + " h3").should("have.text", "Beta");
cy.get(sectionSelector + " h2").should("contain", "Beta");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of B.");
});

it("contains the category Gamma and its description", () => {
const sectionSelector = ".col-content .tsd-index-section:nth-of-type(3)";
const sectionSelector = ".col-content .tsd-panel-group:nth-of-type(3)";

cy.get(sectionSelector + " h3").should("have.text", "Gamma");
cy.get(sectionSelector + " h2").should("contain", "Gamma");
cy.get(sectionSelector + " p").should("have.text", "Category description from the file of C.");
});
});
29 changes: 12 additions & 17 deletions test/prepare_test.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require("fs");
const path = require("path");
import fs from "node:fs/promises";
import path from "node:path";

console.log("=================================== SETTING UP THE TESTS ===========================================");

if (!fs.existsSync(path.join("..", "dist"))) {
if (
!(await fs
.access(path.join("..", "dist"))
.then(() => true)
.catch(() => false))
) {
console.error("ERROR: Cannot find 'dist' folder. Did you forget to build the plugin with 'npm run build'?");
process.exit(1);
}

console.log("Copying current build of plugin to node_modules for testing...");
const nodeModulesSubDir = path.join("..", "node_modules", "typedoc-plugin-merge-modules");

fs.rm(nodeModulesSubDir, { recursive: true, force: true }, (rmErr) => {
if (rmErr) {
throw rmErr;
}
fs.mkdir(path.join(nodeModulesSubDir, "dist"), { recursive: true }, (mkDirErr) => {
if (mkDirErr) {
throw mkDirErr;
} else {
fs.copyFileSync(path.join("..", "package.json"), path.join(nodeModulesSubDir, "package.json"));
fs.cpSync(path.join("..", "dist"), path.join(nodeModulesSubDir, "dist"), { recursive: true });
}
});
});
await fs.rm(nodeModulesSubDir, { recursive: true, force: true });
await fs.mkdir(path.join(nodeModulesSubDir, "dist"), { recursive: true });
await fs.copyFile(path.join("..", "package.json"), path.join(nodeModulesSubDir, "package.json"));
await fs.cp(path.join("..", "dist"), path.join(nodeModulesSubDir, "dist"), { recursive: true });

console.log("DONE\n");
3 changes: 1 addition & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { execSync } = require("child_process");
import { execSync } from "node:child_process";
const execOptions = { stdio: "inherit" };

console.log("===================================== TEST MERGE OFF ===============================================");
Expand Down
Loading

0 comments on commit 465b2dc

Please sign in to comment.