Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate api refs with typedoc #3152

Merged
merged 51 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
daa9df6
Generate api refs with typedoc
bracesproul Nov 3, 2023
b496394
update langchain build script
bracesproul Nov 3, 2023
71eea81
wrap api site with nextjs site and gitignore any auto gen docs
bracesproul Nov 6, 2023
221946d
update gitignore
bracesproul Nov 6, 2023
441debd
del file
bracesproul Nov 6, 2023
7f5173b
update scripts
bracesproul Nov 6, 2023
703dfe5
Merge branch 'main' into brace/api-refs-docs
bracesproul Nov 6, 2023
59b327c
nit
bracesproul Nov 6, 2023
0074d89
improved script
bracesproul Nov 6, 2023
ccf7ae7
remove api gen from docusaurus
bracesproul Nov 6, 2023
6a44bc0
omit readme from api docs gen
bracesproul Nov 6, 2023
1da4e66
conditonal api docs build
bracesproul Nov 6, 2023
90e85fa
gh action only runs on PR not push
bracesproul Nov 6, 2023
fbfa1e1
update
bracesproul Nov 6, 2023
ea17cd4
Merge branch 'main' into brace/api-refs-docs
bracesproul Nov 6, 2023
e89df62
set shell to bash and update readme
bracesproul Nov 6, 2023
0441792
another updaye
bracesproul Nov 6, 2023
29c2bae
stop escaping double quote
bracesproul Nov 6, 2023
a3f2c7a
use shell script for conditional check
bracesproul Nov 6, 2023
6ff3f06
remove deploy preview
bracesproul Nov 6, 2023
a382a80
fix api ref links and codeblock link gen. also added api to header ex…
bracesproul Nov 6, 2023
68273aa
refactor code, slight cleanup
bracesproul Nov 6, 2023
7575703
fix: update docs build
bracesproul Nov 6, 2023
d09eb8b
chore: lint files
bracesproul Nov 6, 2023
45814a6
Merge branch 'main' into brace/api-refs-docs
bracesproul Nov 9, 2023
dec9b48
del gh actions for api docs
bracesproul Nov 9, 2023
89de518
added script for adding ignore to all classes
bracesproul Nov 10, 2023
7de1eb4
better
bracesproul Nov 10, 2023
c53dadf
ignore abstract
bracesproul Nov 10, 2023
533aa18
dont ignore abstract
bracesproul Nov 10, 2023
d548d02
cleanup
bracesproul Nov 10, 2023
4c958f5
account for single line jsdoc
bracesproul Nov 10, 2023
e131c13
cr
bracesproul Nov 10, 2023
c1a4a2f
Merge branch 'main' into brace/api-refs-docs
bracesproul Nov 10, 2023
ecf8ec7
nit
bracesproul Nov 10, 2023
7beb247
cr
bracesproul Nov 10, 2023
4ac9cfe
nits
bracesproul Nov 10, 2023
4b30a94
cr
bracesproul Nov 10, 2023
29173f0
cr
bracesproul Nov 10, 2023
d6c5379
fixed
bracesproul Nov 10, 2023
80afca2
cr
bracesproul Nov 10, 2023
62c000e
add api docs redirects
bracesproul Nov 13, 2023
4ff2817
cr
bracesproul Nov 14, 2023
1e57fd3
Merge branch 'main' of https://github.com/langchain-ai/langchainjs in…
bracesproul Nov 14, 2023
655a7e5
chore: lint files
bracesproul Nov 14, 2023
0055a1f
cr
bracesproul Nov 14, 2023
db172c4
build api refs on core docs start
bracesproul Nov 14, 2023
fbe068b
fix api refs staart
bracesproul Nov 14, 2023
eb13bd7
set port to 3001
bracesproul Nov 14, 2023
d09bbb5
only log on error typedoc
bracesproul Nov 14, 2023
6423a63
Update .gitignore
jacoblee93 Nov 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 23 additions & 2 deletions .github/workflows/test-exports.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Environment tests

on:
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI
workflow_call: # Allows triggering the workflow from another workflow
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI
workflow_call: # Allows triggering the workflow from another workflow

# If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run.
Expand Down Expand Up @@ -35,6 +35,9 @@ jobs:
run: yarn install --immutable
- name: Build
run: yarn workspace langchain build
shell: bash
env:
SKIP_API_DOCS: true

- name: Test esbuild exports
run: docker compose -f docker-compose.yml run test-exports-esbuild
Expand All @@ -52,6 +55,9 @@ jobs:
run: yarn install --immutable
- name: Build
run: yarn workspace langchain build
shell: bash
env:
SKIP_API_DOCS: true

- name: Test esm exports
run: docker compose -f docker-compose.yml run test-exports-esm
Expand All @@ -69,6 +75,9 @@ jobs:
run: yarn install --immutable
- name: Build
run: yarn workspace langchain build
shell: bash
env:
SKIP_API_DOCS: true

- name: Test cjs exports
run: docker compose -f docker-compose.yml run test-exports-cjs
Expand All @@ -86,6 +95,9 @@ jobs:
run: yarn install --immutable
- name: Build
run: yarn workspace langchain build
shell: bash
env:
SKIP_API_DOCS: true

- name: Test cf exports
run: docker compose -f docker-compose.yml run test-exports-cf
Expand All @@ -103,6 +115,9 @@ jobs:
run: yarn install --immutable
- name: Build
run: yarn workspace langchain build
shell: bash
env:
SKIP_API_DOCS: true

- name: Test vercel exports
run: docker compose -f docker-compose.yml run test-exports-vercel
Expand All @@ -120,6 +135,9 @@ jobs:
run: yarn install --immutable
- name: Build
run: yarn workspace langchain build
shell: bash
env:
SKIP_API_DOCS: true

- name: Test vite exports
run: docker compose -f docker-compose.yml run test-exports-vite
Expand All @@ -137,6 +155,9 @@ jobs:
run: yarn install --immutable
- name: Build
run: yarn workspace langchain build
shell: bash
env:
SKIP_API_DOCS: true

- name: Test bun exports
run: docker compose -f docker-compose.yml run test-exports-bun
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ firestore-debug.log
tmp/

**/convex/.gitignore
**/convex/tsconfig.json
**/convex/tsconfig.json

langchain/api_refs_docs_build/dist/**/*

.docusaurus/
docs/build/
3 changes: 3 additions & 0 deletions docs/api_refs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
39 changes: 39 additions & 0 deletions docs/api_refs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# Autogenerated docs
/public/*
11 changes: 11 additions & 0 deletions docs/api_refs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Auto-generated API documentation for LangChainJS

Do not edit the contents of this directory directly.

## Usage

To build the API refs run `yarn build` from the root of this directory, then `yarn dev` or `yarn start` to serve the docs locally.
This app uses [Typedoc](https://typedoc.org/) to generate API references from the source code. The generated HTML is then placed inside the `/public` directory, which is served by [Next.js](https://nextjs.org/).
There is a default redirect when requests are made to `/` which redirects to `/index.html`.

The API references are gitignored by default, so they will not be committed to the repo.
23 changes: 23 additions & 0 deletions docs/api_refs/generate_typedoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

BASE_DIR="../../langchain"

# Create a directory to temp hold the files in src
# `api_refs_docs_build` is gitignored by default.
mkdir -p "$BASE_DIR/api_refs_docs_build/dist"

# Copy the contents of src to docs/dist
cp -r "$BASE_DIR/src/." "$BASE_DIR/api_refs_docs_build/dist/"

# This command will add `@ignore` to JSDoc comments
# for properties which should be ignored.
yarn add-ignore-comments

# This command will generate the docs
yarn typedoc

# Remove the current contents of langchain/src
rm -rf "$BASE_DIR/api_refs_docs_build/*"

# Copy the unedited contents from docs/dist to langchain/src
cp -r "$BASE_DIR/api_refs_docs_build/dist/." "$BASE_DIR/src/"
14 changes: 14 additions & 0 deletions docs/api_refs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
async redirects() {
return [
{
source: '/',
destination: '/index.html',
permanent: false,
},
]
},
}

module.exports = nextConfig
30 changes: 30 additions & 0 deletions docs/api_refs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "api_refs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"typedoc": "npx typedoc --options typedoc.json",
"build:typedoc": "bash ./generate_typedoc.sh",
"add-ignore-comments": "cd ../../langchain && node scripts/build-for-api-ref-docs.js",
"build": "yarn build:typedoc && next build",
"start": "yarn build && next start -p 3001",
"lint": "next lint"
},
"dependencies": {
"next": "14.0.1",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.1",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"typescript": "^5"
}
}
6 changes: 6 additions & 0 deletions docs/api_refs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
File renamed without changes.
20 changes: 20 additions & 0 deletions docs/api_refs/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Config } from 'tailwindcss'

const config: Config = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
},
},
plugins: [],
}
export default config
27 changes: 27 additions & 0 deletions docs/api_refs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Loading