Skip to content

Commit 910001c

Browse files
authored
feat: reference docs (#640)
Adds a new `reference/` path that centralizes the logic for creating reference documentation ## For Python We can leverage the existing reference docs pipeline thats used within the `langchain` repo, and adapting it to include docs from more sources (see langchain-ai/langchain#33066). More details about how this works are in `reference/python/README.md`. ## For TypeScript We'll be keeping the existing [typedoc](https://typedoc.org/) library to render references, but we're onshoring the work of consolidating those into one reference site within this repo. The basic process of how that happens is: * by reading a statically defined list of packages and their locations (defined in reference/javascript/build.ts`) * doing a shallow clone of each unique repo + branch * doing the appropriate install steps so that types can be inferred properly * extracting package entrypoints by reading the `exports` key in `package.json` * pointing typedoc to add those as entrypoints with the [packages strategy](https://typedoc.org/documents/Options.Input.html#packages) * building the typedoc outputs to reference/dist/javascript/ ## New `make` targets - `make build-references` will run scripts to format python + js reference documentation concurrently (which will end up in reference/dist/) - `make preview-references` will run aforementioned build scripts and start a dev server (this won't work until a vercel project is configured) ## Vercel Setup In order for these changes to be reflected on `reference.langchain.com`, a new Vercel project needs to be created (which can happen once this is merged). This was tested against a "test" vercel setup and works as expected, with both reference targets accessible from their respective subpaths
1 parent c6509e2 commit 910001c

23 files changed

+5300
-2
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ indent_size = 4
2727

2828
# JavaScript/TypeScript files
2929
[*.{js,jsx,ts,tsx}]
30-
indent_size = 4
30+
indent_size = 2
3131

3232
# JSON files
3333
[*.{json,jsonc}]

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: dev build format lint test install clean lint_md lint_md_fix mint-broken-links mint-broken-links-all format-check
1+
.PHONY: dev build format lint test install clean lint_md lint_md_fix mint-broken-links mint-broken-links-all build-references preview-references format-check
22

33
dev:
44
@echo "Starting development mode..."
@@ -74,12 +74,25 @@ mint-broken-links-all: build
7474
@command -v mint >/dev/null 2>&1 || { echo "Error: mint is not installed. Run 'npm install -g [email protected]'"; exit 1; }
7575
@cd build && mint broken-links 2>&1 | python3 ../scripts/filter_broken_links.py
7676

77+
check-pnpm:
78+
@command -v pnpm >/dev/null 2>&1 || { echo >&2 "pnpm is not installed. Please install pnpm to proceed (https://pnpm.io/installation)"; exit 1; }
79+
80+
build-references: check-pnpm
81+
@echo "Building references..."
82+
cd reference && pnpm i && pnpm build
83+
84+
preview-references: check-pnpm
85+
@echo "Previewing references..."
86+
cd reference && pnpm i && pnpm run preview
87+
7788
help:
7889
@echo "Available commands:"
7990
@echo " make dev - Start development mode with file watching and mint dev"
8091
@echo " make build - Build documentation to ./build directory"
8192
@echo " make mint-broken-links - Check for broken links in built documentation (excludes integrations)"
8293
@echo " make mint-broken-links-all - Check for broken links in built documentation (includes all directories)"
94+
@echo " make build-references - Build reference docs"
95+
@echo " make preview-references - Preview reference docs"
8396
@echo " make format - Format code"
8497
@echo " make lint - Lint code"
8598
@echo " make lint_md - Lint markdown files"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Documentation changes follow a PR workflow where all tests must pass before merg
1313
```text
1414
src/ # Source documentation files (edit these)
1515
build/ # Generated output files (do not edit)
16+
reference/ # Reference docs pipeline
1617
pipeline/ # Build pipeline source code
1718
tests/ # Test files for the pipeline
1819
Makefile # Build automation
@@ -75,6 +76,8 @@ Makefile # Build automation
7576
- `make build` - Build documentation to `./build` directory
7677
- `make mint-broken-links` - Check for broken links in built documentation (excludes integrations)
7778
- `make mint-broken-links-all` - Check for broken links in built documentation (includes all directories)
79+
- `make build-references` - Build reference docs
80+
- `make preview-references` - Preview reference docs
7881
- `make install` - Install all dependencies
7982
- `make clean` - Remove build artifacts
8083
- `make test` - Run the test suite

reference/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vercel

reference/javascript/.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
public
3+
remotes
4+
dist
5+

reference/javascript/.eslintrc.cjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
es2022: true,
6+
},
7+
parser: '@typescript-eslint/parser',
8+
parserOptions: {
9+
ecmaVersion: 'latest',
10+
sourceType: 'module',
11+
},
12+
plugins: ['@typescript-eslint'],
13+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
14+
rules: {
15+
'@typescript-eslint/no-explicit-any': 'off',
16+
},
17+
ignorePatterns: ['node_modules/', 'public/', 'remotes/', 'dist/'],
18+
};

reference/javascript/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*
2+
node_modules
3+
!.gitignore
4+
!.prettierrc
5+
!.prettierignore
6+
!eslint.config.mjs
7+
!build.ts
8+
!Makefile
9+
!package.json
10+
!pnpm-lock.yaml
11+
!tsconfig.json
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
public
3+
remotes
4+
dist
5+
pnpm-lock.yaml
6+

reference/javascript/.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 100,
7+
"bracketSpacing": true,
8+
"arrowParens": "always"
9+
}

0 commit comments

Comments
 (0)