-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0d2eeb
commit 4d900c2
Showing
15 changed files
with
81 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 11 additions & 8 deletions
19
generators/typescript/utils/commons/src/codegen-utils/maybeAddDocs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { JSDocableNode, JSDocableNodeStructure } from "ts-morph"; | ||
|
||
export function maybeAddDocs(node: JSDocableNodeStructure | JSDocableNode, docs: string | null | undefined): void { | ||
export function maybeAddDocsNode(node: JSDocableNode, docs: string | null | undefined): void { | ||
if (docs != null) { | ||
docs = "\n" + docs; | ||
if ("docs" in node) { | ||
// add newline so ts-morph makes it a multiline comment | ||
node.docs = [docs]; | ||
return; | ||
} else if ("addJsDoc" in node) { | ||
node.addJsDoc(docs); | ||
} | ||
node.addJsDoc(docs); | ||
} | ||
} | ||
|
||
export function maybeAddDocsStructure(node: JSDocableNodeStructure, docs: string | null | undefined): void { | ||
if (docs != null) { | ||
docs = "\n" + docs; | ||
// add newline so ts-morph makes it a multiline comment | ||
node.docs = [docs]; | ||
return; | ||
} | ||
} |
9 changes: 5 additions & 4 deletions
9
generators/typescript/utils/commons/src/codegen-utils/writerToString.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { CodeBlockWriter, ts, WriterFunction } from "ts-morph"; | ||
import { CodeBlockWriter, WriterFunction } from "ts-morph"; | ||
|
||
export function writerToString(writer: WriterFunction | string): string { | ||
if (typeof writer === "string") return writer; | ||
let result = ""; | ||
if (typeof writer === "string") { | ||
return writer; | ||
} | ||
// Create a minimal writer context that captures the output | ||
const writerContext = new CodeBlockWriter(); | ||
// Execute the writer with our context | ||
writer(writerContext); | ||
return result; | ||
return writerContext.toString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.