Skip to content

Commit

Permalink
- Fix: project documents were removed when merging into a single project
Browse files Browse the repository at this point in the history
- Adjust merge-project unit test accordingly
  • Loading branch information
krisztianb committed Sep 21, 2024
1 parent f7b4932 commit 557a5f2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/merger/project_merger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ export class ProjectMerger {
*/
private clearProject(): void {
this.project.children = [];
this.project.documents = [];
this.project.childrenIncludingDocuments = [];
this.project.children.forEach((child) => this.project.removeReflection(child));

// keep project documents that are included with the TypeDoc config parameter "projectDocuments"
this.project.childrenIncludingDocuments =
this.project.childrenIncludingDocuments?.filter((item) => item instanceof DocumentReflection) ?? [];
}

/**
Expand Down
1 change: 1 addition & 0 deletions test/merge-project/input/project-documents/doc1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is the project documentation file doc1.md
4 changes: 4 additions & 0 deletions test/merge-project/test.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ describe("index.html", () => {
cy.get("nav").find("a[href='./classes/B.html']");
cy.get("nav").find("a[href='./classes/C.html']");
});

it("contains a link to the project documentation", () => {
cy.get("nav").find("a[href='./documents/doc1.html']");
});
});
10 changes: 10 additions & 0 deletions test/merge-project/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "Project Merge-Project",
"entryPoints": ["input/*.ts"],
"entryPointStrategy": "expand",
"projectDocuments": ["input/project-documents/*.md"],
"out": "output",
"plugin": ["typedoc-plugin-merge-modules"],
"mergeModulesMergeMode": "project"
}
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ execSync("call npx cypress run --quiet --spec 'merge-off/test.cy.ts'", { stdio:

console.log("=================================== TEST MERGE PROJECT =============================================");
// prettier-ignore
execSync("npx typedoc --tsconfig merge-project/tsconfig.json --plugin typedoc-plugin-merge-modules --mergeModulesMergeMode project --entryPointStrategy expand --out merge-project/output merge-project/input", { stdio: "inherit" });
execSync("cd merge-project && npx typedoc", { stdio: "inherit" });
execSync("npx cypress run --quiet --spec 'merge-project/test.cy.ts'", { stdio: "inherit" });

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

0 comments on commit 557a5f2

Please sign in to comment.