Skip to content

Commit

Permalink
Brace/new api refs build (#3303)
Browse files Browse the repository at this point in the history
* Update api refs build script

* update scripts

* update scripts, remove unused files

* rm langchain

* cleanup scripts

* gave better name

* remove echo

* Update package.json

* revert cjs

* cr

* rm unused script

* cr
  • Loading branch information
bracesproul authored Nov 16, 2023
1 parent 8487dec commit b9e9202
Show file tree
Hide file tree
Showing 11 changed files with 325 additions and 307 deletions.
1 change: 1 addition & 0 deletions docs/api_refs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ next-env.d.ts

# Autogenerated docs
/public/*
/langchain
23 changes: 0 additions & 23 deletions docs/api_refs/generate_typedoc.sh

This file was deleted.

13 changes: 7 additions & 6 deletions docs/api_refs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"typedoc": "npx typedoc --options typedoc.json && yarn update-css",
"build:typedoc": "bash ./generate_typedoc.sh",
"add-ignore-comments": "cd ../../langchain && node scripts/build-for-api-ref-docs.js",
"update-css": "node ./scripts/update-typedoc-css.js",
"build": "yarn build:typedoc && next build",
"dev": "next dev -p 3001",
"typedoc": "npx typedoc --options typedoc.json",
"build:scripts": "node ./scripts/generate-api-refs.js && node ./scripts/update-typedoc-css.js",
"build": "yarn build:scripts && next build",
"start": "yarn build && next start -p 3001",
"lint": "next lint"
},
Expand All @@ -18,14 +16,17 @@
"react-dom": "^18"
},
"devDependencies": {
"@types/fs-extra": "^11",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.1",
"fs-extra": "^11.1.1",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"ts-morph": "^20.0.0",
"typescript": "^5"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Project, SyntaxKind } from "ts-morph";
const { Project, SyntaxKind } = require("ts-morph");
const { exec } = require("child_process");
const fse = require("fs-extra");

async function main() {
async function updateCodeWithIgnoreTags(tsConfigFilePath) {
const project = new Project({
tsConfigFilePath: "./tsconfig.json",
tsConfigFilePath,
});
const sourceFiles = project.getSourceFiles();
/**
Expand Down Expand Up @@ -64,4 +66,37 @@ async function main() {

await project.save();
}

async function copyLangChain(pathToLangChain) {
// copy the entire langchain dir to .

await fse.copy(pathToLangChain, "./langchain", { overwrite: false });
return {
rootPath: `${process.cwd()}/langchain`,
tsConfigPath: `${process.cwd()}/langchain/tsconfig.json`,
};
}

async function deleteLangChain(pathToLangChain) {
// delete the langchain dir
await fse.remove(pathToLangChain);
}

const execAsync = async (command, options) => new Promise((resolve, reject) => {
exec(command, options, (err, stdout, stderr) => {
if (err) {
reject(err);
} else {
resolve(stdout);
}
});
});

async function main() {
const pathToLangChain = "../../langchain";
const { rootPath, tsConfigPath } = await copyLangChain(pathToLangChain);
await updateCodeWithIgnoreTags(tsConfigPath);
await execAsync("yarn typedoc");
await deleteLangChain(rootPath);
}
main();
Loading

1 comment on commit b9e9202

@vercel
Copy link

@vercel vercel bot commented on b9e9202 Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

langchainjs-docs – ./docs/core_docs/

langchainjs-docs-git-main-langchain.vercel.app
js.langchain.com
langchainjs-docs-langchain.vercel.app
langchainjs-docs-ruddy.vercel.app

Please sign in to comment.