Getting Started with docs-ng
This tutorial will walk you through setting up and using docs-ng to aggregate documentation from multiple repositories.
Source Repository: gardenlinux/docs-ng
Prerequisites
- Python 3.x
- pnpm (for VitePress)
- Git
Step 1: Clone the Repository
git clone https://github.com/gardenlinux/docs-ng.git
cd docs-ngStep 2: Install Dependencies
pnpm installThis installs VitePress and other Node.js dependencies needed to build the documentation site.
Step 3: Aggregate Documentation
From Remote Repositories (Production)
Aggregate from locked commits in repos-config.json:
make aggregateThis fetches documentation from the configured repositories at their locked commit hashes.
From Local Repositories (Development)
For local development, use repos-config.local.json with file:// URLs:
make aggregate-localThis copies documentation from local repositories without using git.
Step 4: Start the Development Server
make devThe documentation site will be available at http://localhost:5173.
Step 5: Make Changes
As you work on documentation in source repositories:
- Make changes to markdown files in source repos
- Run
make aggregate-localto update the aggregated docs - The dev server will hot-reload automatically
Step 6: Build for Production
When ready to deploy:
make buildThis creates a production build in docs/.vitepress/dist/.
Common Workflows
Updating a Single Repository
make aggregate-repo REPO=gardenlinuxUpdating Lock Files
To fetch the latest commits and update repos-config.json:
make aggregate-updateRunning Tests
make testProject Structure
After aggregation, your docs directory will look like:
docs/
├── projects/ # Mirrored repository docs
│ ├── gardenlinux/
│ ├── builder/
│ └── python-gardenlinux-lib/
├── tutorials/ # Aggregated tutorials
├── how-to/ # Aggregated guides
├── explanation/ # Aggregated explanations
├── reference/ # Aggregated reference
└── contributing/ # Aggregated contributing docsNext Steps
- Learn how to add new repositories
- Understand the architecture
- Review the configuration reference
Troubleshooting
Clean Build
If you encounter issues, try a clean build:
make clean
make aggregate
make devCheck Dependencies
Ensure all dependencies are installed:
pnpm install
python3 --version # Should be 3.xVerify Configuration
Check that repos-config.json or repos-config.local.json is properly configured. See the configuration reference for details.