From a7f03f6e9835b452cb17a7d9c780094ead622987 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:22:57 +0000 Subject: [PATCH 1/5] Update docs build and serve scripts --- .github/workflows/deploy-website-mintlify.yml | 20 ++++--------------- scripts/docs_build.sh | 15 ++++++++++---- scripts/docs_serve.sh | 17 ++++++++++++---- website/README.md | 12 ++--------- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index b0f9a27ec7..712152284c 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -49,15 +49,9 @@ jobs: - name: Install quarto uses: quarto-dev/quarto-actions/setup@v2 - - name: Generate API documentation + - name: Build documentation run: | - python ./process_api_reference.py - working-directory: website - - - name: Convert Jupyter notebooks to MDX - run: | - python ./process_notebooks.py render - working-directory: website + ./scripts/docs_build.sh - name: Prepare website content run: | @@ -95,15 +89,9 @@ jobs: - name: Install quarto uses: quarto-dev/quarto-actions/setup@v2 - - name: Generate API documentation + - name: Build documentation run: | - python ./process_api_reference.py - working-directory: website - - - name: Convert Jupyter notebooks to MDX - run: | - python ./process_notebooks.py render - working-directory: website + ./scripts/docs_build.sh - name: Prepare website content run: | diff --git a/scripts/docs_build.sh b/scripts/docs_build.sh index e07029cccf..2d8ffeb5fb 100755 --- a/scripts/docs_build.sh +++ b/scripts/docs_build.sh @@ -3,7 +3,14 @@ set -e set -x -cd website && - yarn install --frozen-lockfile --ignore-engines && - pydoc-markdown && - yarn build +# Function to build documentation +docs_build() { + cd website && + python ./process_api_reference.py && + python ./process_notebooks.py render +} + +# Execute the function only if the script is run directly +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + docs_build +fi diff --git a/scripts/docs_serve.sh b/scripts/docs_serve.sh index 99239e7cd3..acc0ee0823 100755 --- a/scripts/docs_serve.sh +++ b/scripts/docs_serve.sh @@ -3,7 +3,16 @@ set -e set -x -cd website && - yarn install --frozen-lockfile --ignore-engines && - pydoc-markdown && - yarn start +# Source the docs_build.sh script from the same directory +source "$(dirname "$0")/docs_build.sh" + +# Run the docs_build function from docs_build.sh +docs_build + +# Install npm packages +echo "Running npm install..." +npm install + +# Add the command to serve the documentation +echo "Serving documentation..." +npm run mintlify:dev diff --git a/website/README.md b/website/README.md index 01bff706ef..7bdd03be4e 100644 --- a/website/README.md +++ b/website/README.md @@ -25,11 +25,7 @@ pip install pydoc-markdown pyyaml termcolor nbclient 3. Finally, run the following commands to build and serve the documentation: ```console -cd website -python ./process_api_reference.py -python ./process_notebooks.py render -npm install -npm run mintlify:dev +./scripts/docs_serve.sh ``` The last command starts a local development server and opens up a browser window. @@ -52,11 +48,7 @@ docker run -it -p 8081:3000 -v $(pwd):/home/autogen/ag2 ag2ai_dev_img bash Once at the CLI in Docker run the following commands: ```console -cd website -python ./process_api_reference.py -python ./process_notebooks.py render -npm install -npm run mintlify:dev +./scripts/docs_serve.sh ``` Once done you should be able to access the documentation at `http://127.0.0.1:8081` From dae2ab1ffecfba8a8a5c4399b76b93c6532a189e Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:27:06 +0000 Subject: [PATCH 2/5] Update docs build and serve scripts --- .github/workflows/deploy-website-mintlify.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index 712152284c..7952b95a50 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -51,7 +51,8 @@ jobs: - name: Build documentation run: | - ./scripts/docs_build.sh + ./docs_build.sh + working-directory: scripts - name: Prepare website content run: | @@ -91,7 +92,8 @@ jobs: - name: Build documentation run: | - ./scripts/docs_build.sh + ./docs_build.sh + working-directory: scripts - name: Prepare website content run: | From 21819849330389cedc0008e81bde3302cd27d094 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:39:46 +0000 Subject: [PATCH 3/5] Update docs build and serve scripts --- .github/workflows/deploy-website-mintlify.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index 7952b95a50..ec0bdde156 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -51,8 +51,9 @@ jobs: - name: Build documentation run: | - ./docs_build.sh - working-directory: scripts + pwd + ls + ./scripts/docs_build.sh - name: Prepare website content run: | @@ -91,9 +92,7 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: | - ./docs_build.sh - working-directory: scripts + run: ./scripts/docs_build.sh - name: Prepare website content run: | From b09bcbf0f38e88a2775970e70d79d12d605b0653 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:43:14 +0000 Subject: [PATCH 4/5] Fix path --- .github/workflows/deploy-website-mintlify.yml | 7 ++-- website/build_website.sh | 35 ------------------- 2 files changed, 2 insertions(+), 40 deletions(-) delete mode 100755 website/build_website.sh diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index ec0bdde156..93946ebc40 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -50,10 +50,7 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: | - pwd - ls - ./scripts/docs_build.sh + run: ../scripts/docs_build.sh - name: Prepare website content run: | @@ -92,7 +89,7 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: ./scripts/docs_build.sh + run: ../scripts/docs_build.sh - name: Prepare website content run: | diff --git a/website/build_website.sh b/website/build_website.sh deleted file mode 100755 index e4d6441be1..0000000000 --- a/website/build_website.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# This script generates documentation using pydoc-markdown and renders the website using Quarto. -# - -missing_deps=false - -# -# Check for missing dependencies, report them, and exit when building the -# website is likely to fail. -# -for dependency in node pydoc-markdown quarto python yarn npm -do - if ! command -v "$dependency" &> /dev/null - then - echo "Command '$dependency' not found." - missing_deps=true - fi -done - -if [ "$missing_deps" = true ] -then - echo -e "\nSome of the dependencies are missing." - echo "Please install them to build the website." - exit 1 -fi - -# Generate documentation using pydoc-markdown -pydoc-markdown - -# Process notebooks using a Python script -python ./process_notebooks.py render - -# Start the website using yarn -yarn start From 27b5b9617becfda65cd75d0a7aaec6c49d26cc64 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:49:47 +0000 Subject: [PATCH 5/5] Fix path --- .github/workflows/deploy-website-mintlify.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index 93946ebc40..b630fe5474 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -50,7 +50,8 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: ../scripts/docs_build.sh + run: ./scripts/docs_build.sh + working-directory: . - name: Prepare website content run: | @@ -89,7 +90,8 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: ../scripts/docs_build.sh + run: ./scripts/docs_build.sh + working-directory: . - name: Prepare website content run: |