Skip to content

Commit 2c99025

Browse files
committed
api_refs[minor]: Typedoc monorepo support
1 parent c35bf4d commit 2c99025

File tree

6 files changed

+41
-17
lines changed

6 files changed

+41
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ docs/api_refs/typedoc.json
4646

4747
.tool-versions
4848
credentials.json
49+
**/typedoc.json

docs/api_refs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"postcss": "^8",
3030
"prettier": "^2.8.3",
3131
"tailwindcss": "^3.3.0",
32-
"typedoc": "^0.26.0",
32+
"typedoc": "^0.26.1",
3333
"typescript": "~5.1.6"
3434
}
3535
}

docs/api_refs/scripts/create-entrypoints.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const BASE_TYPEDOC_CONFIG = {
2626
skipErrorChecking: true,
2727
exclude: ["dist"],
2828
hostedBaseUrl: "https://v02.api.js.langchain.com/",
29+
entryPointStrategy: "packages",
30+
entryPoints: ["../../langchain", "../../langchain-core", "../../libs/*"]
2931
};
3032

3133
/**
@@ -70,7 +72,7 @@ async function main() {
7072
langChainConfig.config.entrypoints === null ||
7173
langChainConfig.config.entrypoints === undefined
7274
) {
73-
return;
75+
continue;
7476
}
7577
const { config } = langChainConfig;
7678

@@ -82,7 +84,7 @@ async function main() {
8284
const deprecatedNodeOnly =
8385
"deprecatedNodeOnly" in config ? config.deprecatedNodeOnly : [];
8486

85-
Object.values(config.entrypoints)
87+
const workspaceEntrypoints = Object.values(config.entrypoints)
8688
.filter((key) => !deprecatedNodeOnly.includes(key))
8789
.filter(
8890
(key) =>
@@ -91,16 +93,29 @@ async function main() {
9193
blacklistedItem === `${entrypointDir}/src/${key}.ts`
9294
)
9395
)
94-
.map((key) => entrypoints.add(`${entrypointDir}/src/${key}.ts`));
96+
.map((key) => `src/${key}.ts`);
97+
98+
const typedocPath = path.join(entrypointDir, "typedoc.json");
99+
100+
if (!fs.existsSync(typedocPath)) {
101+
fs.writeFileSync(typedocPath, "{}\n");
102+
}
103+
104+
updateJsonFile(typedocPath, (existingConfig) => ({
105+
...existingConfig,
106+
entryPoints: workspaceEntrypoints,
107+
extends: typedocPath.includes("/libs/") ? ["../../docs/api_refs/typedoc.base.json"] : ["../docs/api_refs/typedoc.base.json"]
108+
}));
95109
}
110+
96111
// Check if the `./typedoc.json` file exists, since it is gitignored by default
97112
if (!fs.existsSync("./typedoc.json")) {
98113
fs.writeFileSync("./typedoc.json", "{}\n");
99114
}
100115

101116
updateJsonFile("./typedoc.json", () => ({
102117
...BASE_TYPEDOC_CONFIG,
103-
entryPoints: Array.from(entrypoints),
118+
// entryPoints: Array.from(entrypoints),
104119
}));
105120
}
106121
main();

docs/api_refs/typedoc.base.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"includeVersion": true
4+
}

docs/api_refs/typedoc_plugins/hide_underscore_lc.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,30 @@ function load(application) {
9999
* @returns {void}
100100
*/
101101
function onBeginResolve(context) {
102-
reflectionsToHide.forEach((reflection) => {
103-
const { project } = context;
104-
// Remove the property from documentation
105-
project.removeReflection(reflection);
106-
});
102+
// reflectionsToHide.forEach((reflection) => {
103+
// const { project } = context;
104+
// // Remove the property from documentation
105+
// project.removeReflection(reflection);
106+
// });
107107
}
108108

109109
/**
110110
* @param {Context} _context
111111
* @param {DeclarationReflection} reflection
112112
* @returns {void}
113113
*/
114-
function resolveReflection(_context, reflection) {
114+
function resolveReflection(context, reflection) {
115+
const { project } = context;
116+
115117
const reflectionKind = reflection.kind;
116118
if (reflectionKindsToHide.includes(reflectionKind)) {
117119
if (
118120
reflection.name.startsWith("_") ||
119121
reflection.name.startsWith("lc_")
120122
) {
121-
reflectionsToHide.push(reflection);
123+
// Remove the property from documentation
124+
project.removeReflection(reflection);
125+
// reflectionsToHide.push(reflection);
122126
}
123127
}
124128
if (reflection.name.includes("/src")) {

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20486,7 +20486,7 @@ __metadata:
2048620486
react: ^18
2048720487
react-dom: ^18
2048820488
tailwindcss: ^3.3.0
20489-
typedoc: ^0.26.0
20489+
typedoc: ^0.26.1
2049020490
typescript: ~5.1.6
2049120491
languageName: unknown
2049220492
linkType: soft
@@ -41139,9 +41139,9 @@ __metadata:
4113941139
languageName: node
4114041140
linkType: hard
4114141141

41142-
"typedoc@npm:^0.26.0":
41143-
version: 0.26.3
41144-
resolution: "typedoc@npm:0.26.3"
41142+
"typedoc@npm:^0.26.1":
41143+
version: 0.26.5
41144+
resolution: "typedoc@npm:0.26.5"
4114541145
dependencies:
4114641146
lunr: ^2.3.9
4114741147
markdown-it: ^14.1.0
@@ -41152,7 +41152,7 @@ __metadata:
4115241152
typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x
4115341153
bin:
4115441154
typedoc: bin/typedoc
41155-
checksum: 3e4fc7cbd455e2adf591b4d01f191fa9518e56a4a2ee659ba1d4d221902656dc1f3572a726443b91bb3586bb485e783d924670f7a9087602153ef04ea2dcbd82
41155+
checksum: 0587096c2b91536249d3aa9cc5e83a43086e318006ddeadc3c21c424d10a934b6bc19c56fda682d16a75f8133eb2730f54adace79996adeec89188fe331594c3
4115641156
languageName: node
4115741157
linkType: hard
4115841158

0 commit comments

Comments
 (0)