2024-05-02 00:34:05 +00:00
|
|
|
# we build the docs in these stages:
|
2024-05-07 19:30:17 +00:00
|
|
|
# 1. install vercel and python dependencies
|
2024-05-02 00:34:05 +00:00
|
|
|
# 2. copy files from "source dir" to "intermediate dir"
|
|
|
|
# 2. generate files like model feat table, etc in "intermediate dir"
|
|
|
|
# 3. copy files to their right spots (e.g. langserve readme) in "intermediate dir"
|
|
|
|
# 4. build the docs from "intermediate dir" to "output dir"
|
|
|
|
|
|
|
|
SOURCE_DIR = docs/
|
|
|
|
INTERMEDIATE_DIR = build/intermediate/docs
|
|
|
|
|
2024-05-07 19:30:17 +00:00
|
|
|
OUTPUT_NEW_DIR = build/output-new
|
|
|
|
OUTPUT_NEW_DOCS_DIR = $(OUTPUT_NEW_DIR)/docs
|
2024-05-02 00:34:05 +00:00
|
|
|
|
2024-05-07 19:30:17 +00:00
|
|
|
PYTHON = .venv/bin/python
|
2024-05-02 00:34:05 +00:00
|
|
|
|
2024-08-08 15:59:02 +00:00
|
|
|
PARTNER_DEPS_LIST := $(shell find ../libs/partners -mindepth 1 -maxdepth 1 -type d -exec sh -c ' \
|
|
|
|
for dir; do \
|
|
|
|
if find "$$dir" -maxdepth 1 -type f \( -name "pyproject.toml" -o -name "setup.py" \) | grep -q .; then \
|
|
|
|
echo "$$dir"; \
|
|
|
|
fi \
|
2024-08-22 00:19:28 +00:00
|
|
|
done' sh {} + | grep -vE "airbyte|ibm|couchbase|databricks" | tr '\n' ' ')
|
2024-05-02 00:34:05 +00:00
|
|
|
|
|
|
|
PORT ?= 3001
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf build
|
|
|
|
|
|
|
|
install-vercel-deps:
|
|
|
|
yum -y update
|
|
|
|
yum install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip rsync -y
|
|
|
|
|
|
|
|
install-py-deps:
|
|
|
|
python3 -m venv .venv
|
|
|
|
$(PYTHON) -m pip install --upgrade pip
|
|
|
|
$(PYTHON) -m pip install --upgrade uv
|
2024-09-13 21:38:45 +00:00
|
|
|
$(PYTHON) -m uv pip install --pre -r vercel_requirements.txt
|
|
|
|
$(PYTHON) -m uv pip install --pre --editable $(PARTNER_DEPS_LIST)
|
2024-05-02 00:34:05 +00:00
|
|
|
|
|
|
|
generate-files:
|
|
|
|
mkdir -p $(INTERMEDIATE_DIR)
|
|
|
|
cp -r $(SOURCE_DIR)/* $(INTERMEDIATE_DIR)
|
|
|
|
|
2024-07-24 17:51:39 +00:00
|
|
|
$(PYTHON) scripts/tool_feat_table.py $(INTERMEDIATE_DIR)
|
|
|
|
|
2024-07-31 20:23:24 +00:00
|
|
|
$(PYTHON) scripts/kv_store_feat_table.py $(INTERMEDIATE_DIR)
|
|
|
|
|
2024-07-30 22:28:10 +00:00
|
|
|
$(PYTHON) scripts/partner_pkg_table.py $(INTERMEDIATE_DIR)
|
|
|
|
|
2024-09-24 04:24:23 +00:00
|
|
|
curl https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md | sed 's/<=/\<=/g' > $(INTERMEDIATE_DIR)/langserve.md
|
2024-05-02 00:34:05 +00:00
|
|
|
$(PYTHON) scripts/resolve_local_links.py $(INTERMEDIATE_DIR)/langserve.md https://github.com/langchain-ai/langserve/tree/main/
|
|
|
|
|
|
|
|
copy-infra:
|
2024-05-07 19:30:17 +00:00
|
|
|
mkdir -p $(OUTPUT_NEW_DIR)
|
|
|
|
cp -r src $(OUTPUT_NEW_DIR)
|
|
|
|
cp vercel.json $(OUTPUT_NEW_DIR)
|
|
|
|
cp babel.config.js $(OUTPUT_NEW_DIR)
|
|
|
|
cp -r data $(OUTPUT_NEW_DIR)
|
|
|
|
cp docusaurus.config.js $(OUTPUT_NEW_DIR)
|
|
|
|
cp package.json $(OUTPUT_NEW_DIR)
|
|
|
|
cp sidebars.js $(OUTPUT_NEW_DIR)
|
|
|
|
cp -r static $(OUTPUT_NEW_DIR)
|
|
|
|
cp yarn.lock $(OUTPUT_NEW_DIR)
|
|
|
|
|
|
|
|
render:
|
|
|
|
$(PYTHON) scripts/notebook_convert.py $(INTERMEDIATE_DIR) $(OUTPUT_NEW_DOCS_DIR)
|
2024-05-02 00:34:05 +00:00
|
|
|
|
|
|
|
md-sync:
|
2024-09-24 22:30:05 +00:00
|
|
|
rsync -avmq --include="*/" --include="*.mdx" --include="*.md" --include="*.png" --include="*/_category_.yml" --exclude="*" $(INTERMEDIATE_DIR)/ $(OUTPUT_NEW_DOCS_DIR)
|
2024-05-02 00:34:05 +00:00
|
|
|
|
2024-07-31 21:25:58 +00:00
|
|
|
append-related:
|
|
|
|
$(PYTHON) scripts/append_related_links.py $(OUTPUT_NEW_DOCS_DIR)
|
|
|
|
|
2024-05-13 21:52:26 +00:00
|
|
|
generate-references:
|
|
|
|
$(PYTHON) scripts/generate_api_reference_links.py --docs_dir $(OUTPUT_NEW_DOCS_DIR)
|
|
|
|
|
2024-08-30 18:54:51 +00:00
|
|
|
update-md: generate-files md-sync
|
|
|
|
|
2024-07-31 21:25:58 +00:00
|
|
|
build: install-py-deps generate-files copy-infra render md-sync append-related
|
2024-05-02 00:34:05 +00:00
|
|
|
|
2024-05-18 02:04:45 +00:00
|
|
|
vercel-build: install-vercel-deps build generate-references
|
2024-05-08 19:29:59 +00:00
|
|
|
rm -rf docs
|
|
|
|
mv $(OUTPUT_NEW_DOCS_DIR) docs
|
|
|
|
rm -rf build
|
2024-08-14 14:00:17 +00:00
|
|
|
mkdir static/api_reference
|
2024-10-01 16:18:54 +00:00
|
|
|
git clone --depth=1 https://github.com/langchain-ai/langchain-api-docs-html.git
|
|
|
|
mv langchain-api-docs-html/api_reference_build/html/* static/api_reference/
|
|
|
|
rm -rf langchain-api-docs-html
|
2024-08-13 22:52:51 +00:00
|
|
|
NODE_OPTIONS="--max-old-space-size=5000" yarn run docusaurus build
|
2024-05-08 19:29:59 +00:00
|
|
|
|
2024-05-02 00:34:05 +00:00
|
|
|
start:
|
2024-05-07 19:30:17 +00:00
|
|
|
cd $(OUTPUT_NEW_DIR) && yarn && yarn start --port=$(PORT)
|