Skip to content

Commit

Permalink
docs[minor]: Autogenerate typedoc config, add to gitignore. (langchai…
Browse files Browse the repository at this point in the history
…n-ai#4079)

* ignore typedoc

* gitignore

* cr

* cr
  • Loading branch information
bracesproul authored Jan 19, 2024
1 parent 53c4acd commit 49eaab9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 411 deletions.
3 changes: 2 additions & 1 deletion docs/api_refs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ next-env.d.ts
# Autogenerated docs
/public/*
/langchain
/langchain-core
/langchain-core
typedoc.json
38 changes: 36 additions & 2 deletions docs/api_refs/scripts/create-entrypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@ const { Project, SyntaxKind } = require("ts-morph");
const fs = require("fs");
const path = require("path");

const BASE_TYPEDOC_CONFIG = {
$schema: "https://typedoc.org/schema.json",
out: "public",
sort: [
"kind",
"visibility",
"instance-first",
"required-first",
"alphabetical"
],
plugin: [
"./typedoc_plugins/hide_underscore_lc.js"
],
tsconfig: "../../tsconfig.json",
readme: "none",
excludePrivate: true,
excludeInternal: true,
excludeExternals: true,
excludeNotDocumented: false,
includeVersion: true,
sourceLinkTemplate: "https://github.com/langchain-ai/langchainjs/blob/{gitRevision}/{path}#L{line}",
logLevel: "Error",
name: "LangChain.js",
skipErrorChecking: true,
exclude: [
"dist"
],
}

/**
*
* @param {string} relativePath
Expand Down Expand Up @@ -70,8 +99,13 @@ function main() {
.map((key) => entrypoints.add(`${entrypointDir}/src/${key}.ts`));
});

updateJsonFile("./typedoc.json", (json) => ({
...json,
// Check if the `./typedoc.json` file exists, since it is gitignored by default
if (!fs.existsSync("./typedoc.json")) {
fs.writeFileSync("./typedoc.json", "{}\n");
}

updateJsonFile("./typedoc.json", () => ({
...BASE_TYPEDOC_CONFIG,
entryPoints: Array.from(entrypoints),
}));
}
Expand Down
Loading

0 comments on commit 49eaab9

Please sign in to comment.