Deployment and Infrastructure
Relevant source files
The following files were used as context for generating this wiki page:
HXLoLi is a technical documentation and blog platform built on the Docusaurus framework. The infrastructure supports multi-target deployment, automated content indexing, and rigorous AI-assisted quality gates to ensure stable production releases.
The project uses a static site generation (SSG) model. It deploys to both GitHub Pages and Cloudflare Workers (Static Assets mode). Automation scripts manage sidebar generation and RSS feeds, while CI/CD workflows enforce code quality through linting and multi-tier testing.
Deployment Configuration
The platform supports two primary deployment targets. The configuration logic differentiates these targets using the DEPLOY_TARGET environment variable.
This diagram shows the conditional logic used to determine the site's base URL based on the hosting environment.
Sources: docusaurus.config.ts:14-19
Hosting Environment Variables
The configuration uses environment variables to adjust paths for different hosting providers.
| Variable | Target | Resulting Base URL | Description |
|---|---|---|---|
DEPLOY_TARGET=cloudflare | Cloudflare Workers | "" | Deploys using wrangler to km.woa.qzz.io. |
| Default | GitHub Pages | "/HXLoLi" | Deploys to HengXin666.github.io/HXLoLi. |
Sources: docusaurus.config.ts:14-22
Asset Protection Guardrails
The build pipeline includes a critical check for image handling. It forces WEBPACK_URL_LOADER_LIMIT to 0. This prevents Webpack from inlining .drawio.svg files as data URIs. Inlining these files would strip the draw.io editing shell, rendering the diagrams uneditable.
Sources: docusaurus.config.ts:31-50
CI/CD and Quality Gates
The project implements a comprehensive CI/CD pipeline triggered by git events. The workflow scans changes at the "diff level" to maintain efficiency.
This sequence illustrates the validation steps required before a push is accepted into the repository.
Sources: blog/2026/10/07/01-AI代码质量.md:144-180
Testing Tiers
The infrastructure defines five distinct testing layers to ensure functional integrity.
| Tier | Focus | Description |
|---|---|---|
| Unit | Business Logic | Tests independent logic without external dependencies. |
| API (Mock) | Backend API | Tests API endpoints using fake data/dependencies. |
| API (Real) | Backend API | Tests API endpoints against real test environment resources. |
| UI | Frontend | Uses mock data to test page display and user interaction. |
| E2E | Full Flow | Verifies complete user journeys and frontend-backend synergy. |
Sources: blog/2026/10/07/01-AI代码质量.md:195-218
Automated Content Pipelines
Automation scripts ensure that dynamically added documentation is correctly indexed in the user interface.
Sidebar Generation
The script generateAiDocsSidebar.js automatically scans the ai-docs/ directory. It generates the sidebarsAiDocs.ts file, which Docusaurus uses to render the AI Knowledge Base navigation.
- Folder Icons: Uses
default-icons/ai-folder.svg. - Document Icons: Uses
default-icons/ai-doc.svg. - Metadata: Parses
tag.jsonwithin folders to apply custom icons and tags.
Sources: scripts/generateAiDocsSidebar.js:15-60, scripts/generateAiDocsSidebar.js:90-97
Static Resource Routing
The ppt-html-assets plugin maps HTML files located within markdown directories to specific routes. This allows PPT-style presentations (like overview-ppt.html) to be served alongside their corresponding articles.
Sources: docusaurus.config.ts:167-195
Infrastructure Standards
The project follows specific architectural and scale constraints to maintain AI context efficiency.
- Directory Scale: Each directory should not exceed 6 files to prevent responsibility confusion.
- File Length: Logic files (Python/TS) are limited to 300 lines; UI files are limited to 500 lines.
- AI Context: The combined size of
AGENTS.mdand skill injections must not exceed 64KB per path to fit within model context windows. - Naming Conventions: AI skills must use lowercase letters, numbers, and hyphens, not exceeding 64 characters.
Sources: blog/2026/10/07/01-AI代码质量.md:93-108, ai-docs/003-AI/005-Skill/002-Agent-Skill编写最佳实践/index.md:310-325
Dependency Management
The project relies on specific versions of the Node.js ecosystem for stability.
{
"dependencies": {
"docusaurus": "3.7.0",
"nodejs": "18",
"npm": "10.7.0",
"typescript": "~5.6.2"
}
}
Sources: README.md:104-114
HXLoLi integrates multi-platform deployment targets with an automated build system. By enforcing strict code quality gates and content metadata standards, the infrastructure provides a scalable environment for both human readers and AI agents.