|
1 | | -# Harper Documentation Site (Docusaurus) |
| 1 | +# Harper Documentation Site |
2 | 2 |
|
3 | | -This directory contains the Docusaurus site for Harper documentation. |
| 3 | +This directory contains the Docusaurus configuration and build files for the Harper documentation site. |
4 | 4 |
|
5 | | -## ⚠️ Important: GitBook to Docusaurus Migration |
| 5 | +## 🚀 Quick Start |
6 | 6 |
|
7 | | -**Current State**: The documentation repository contains GitBook-formatted docs. This Docusaurus site requires converted docs to function properly. |
| 7 | +```bash |
| 8 | +# Install dependencies |
| 9 | +npm install |
8 | 10 |
|
9 | | -## Prerequisites |
| 11 | +# Start development server |
| 12 | +npm start |
| 13 | +# Opens at http://localhost:3000 |
10 | 14 |
|
11 | | -- Both repositories must be on the `docs-in-hdb` branch |
12 | | -- Repositories must be in sibling directories: |
13 | | - ``` |
14 | | - parent-directory/ |
15 | | - ├── documentation/ (on docs-in-hdb branch) |
16 | | - └── harperdb/ (on docs-in-hdb branch) |
17 | | - ``` |
| 15 | +# Build for production |
| 16 | +npm run build |
18 | 17 |
|
19 | | -## Quick Start |
| 18 | +# Serve production build locally |
| 19 | +npm run serve |
| 20 | +``` |
20 | 21 |
|
21 | | -From the documentation repository: |
22 | | -```bash |
23 | | -# Install dependencies |
24 | | -npm run site:install |
| 22 | +## 📁 Directory Structure |
25 | 23 |
|
26 | | -# Sync and preview docs |
27 | | -npm run site:sync-and-dev |
28 | 24 | ``` |
| 25 | +site/ |
| 26 | +├── build/ # Production build output |
| 27 | +├── src/ # React components and custom pages |
| 28 | +│ ├── css/ # Custom styles |
| 29 | +│ └── pages/ # Custom pages |
| 30 | +├── static/ # Static assets |
| 31 | +│ ├── img/ # Images and logos |
| 32 | +│ └── js/ # JavaScript files |
| 33 | +├── versioned_docs/ # Documentation for previous versions |
| 34 | +├── versioned_sidebars/ # Sidebar configurations for versions |
| 35 | +├── docusaurus.config.ts # Main Docusaurus configuration |
| 36 | +├── sidebars.ts # Sidebar navigation structure |
| 37 | +├── redirects.ts # URL redirects configuration |
| 38 | +└── versions.json # Version configuration |
| 39 | +``` |
| 40 | + |
| 41 | +## 🛠️ Development |
| 42 | + |
| 43 | +### Running Locally |
29 | 44 |
|
30 | | -From the harperdb repository: |
31 | 45 | ```bash |
32 | | -# Sync docs and preview |
33 | | -npm run docs:sync:sample |
34 | | -npm run docs:dev |
| 46 | +# Start the development server with hot reload |
| 47 | +npm start |
| 48 | + |
| 49 | +# Clear cache if you encounter issues |
| 50 | +npm run clear |
35 | 51 | ``` |
36 | 52 |
|
37 | | -## How It Works |
| 53 | +The development server runs at `http://localhost:3000` and automatically reloads when you make changes. |
| 54 | + |
| 55 | +### Building |
38 | 56 |
|
39 | | -1. **Source**: GitBook-formatted docs in `documentation/docs/` |
40 | | -1. **Conversion**: Scripts convert GitBook syntax to Docusaurus format |
41 | | -1. **Destination**: Converted docs go to `harperdb/docs/` |
42 | | -1. **Preview**: Docusaurus always reads from `harperdb/docs/` |
| 57 | +```bash |
| 58 | +# Create production build |
| 59 | +npm run build |
43 | 60 |
|
44 | | -## Available Scripts |
| 61 | +# Test production build locally |
| 62 | +npm run serve |
| 63 | +``` |
45 | 64 |
|
46 | | -### From documentation repo (`npm run`): |
47 | | -- `site:install` - Install Docusaurus dependencies |
48 | | -- `site:dev` - Preview converted docs from harperdb (shows warning) |
49 | | -- `site:build` - Build production site from harperdb docs |
50 | | -- `site:sync-and-dev` - Sync sample docs and start preview |
51 | | -- `sync:to-harperdb` - Full sync to harperdb |
52 | | -- `sync:to-harperdb:sample` - Sync sample files only |
| 65 | +The production build is optimized and outputs to the `build/` directory. |
53 | 66 |
|
54 | | -### From harperdb repo (`npm run`): |
55 | | -- `docs:init` - Install dependencies |
56 | | -- `docs:sync` - Sync all docs from documentation repo |
57 | | -- `docs:sync:sample` - Sync sample files for testing |
58 | | -- `docs:dev` - Start preview server |
59 | | -- `docs:build` - Build production site |
| 67 | +## 📋 Cutting a New Version |
60 | 68 |
|
61 | | -### Direct Docusaurus commands (from site directory): |
62 | | -- `npm start` - Start dev server (requires DOCS_PATH env var) |
63 | | -- `npm run build` - Build production site |
64 | | -- `npm run serve` - Serve production build |
65 | | -- `npm run clear` - Clear cache |
| 69 | +When releasing a new version of Harper documentation: |
66 | 70 |
|
67 | | -## Architecture |
| 71 | +```bash |
| 72 | +# Cut a new version (e.g., 4.7) |
| 73 | +npm run version |
68 | 74 |
|
| 75 | +# This will: |
| 76 | +# 1. Copy current docs to versioned_docs/version-4.7 |
| 77 | +# 2. Copy current sidebars to versioned_sidebars |
| 78 | +# 3. Update versions.json |
69 | 79 | ``` |
70 | | -documentation/ harperdb/ |
71 | | -├── docs/ →→→ ├── docs/ |
72 | | -│ (GitBook) sync │ (Docusaurus) |
73 | | -│ and │ |
74 | | -├── site/ convert └── (preview from here) |
75 | | -│ (Docusaurus) |
76 | | -│ |
77 | | -└── images/ →→→ └── docs/images/ |
78 | | -``` |
79 | 80 |
|
80 | | -## Conversion Features |
| 81 | +After cutting a version: |
| 82 | +1. The current `/docs` becomes the new "next" version |
| 83 | +2. The previous latest version is archived |
| 84 | +3. Update `docusaurus.config.ts` to set the new `lastVersion` |
| 85 | + |
| 86 | +## 🔧 Configuration |
81 | 87 |
|
82 | | -The sync scripts handle: |
83 | | -- GitBook hints → Docusaurus admonitions |
84 | | -- GitBook tabs → Docusaurus tabs |
85 | | -- README.md → index.md |
86 | | -- Link fixing (removes .md extensions) |
87 | | -- Image path updates |
88 | | -- Title extraction from headings |
89 | | -- Category generation for directories |
| 88 | +- **`docusaurus.config.ts`** - Main site configuration (metadata, plugins, themes) |
| 89 | +- **`sidebars.ts`** - Documentation navigation structure |
| 90 | +- **`redirects.ts`** - URL redirect rules |
| 91 | +- **`versions.json`** - Available documentation versions |
90 | 92 |
|
91 | | -## Future State |
| 93 | +## 🔍 Search |
92 | 94 |
|
93 | | -Once the migration is complete: |
94 | | -- Documentation repo will contain Docusaurus-formatted docs |
95 | | -- No conversion will be needed |
96 | | -- Can preview directly from documentation repo |
| 95 | +The site includes local search that indexes all documentation content at build time, providing fast client-side search without external dependencies. |
| 96 | + |
| 97 | +## 📝 Other Commands |
| 98 | + |
| 99 | +```bash |
| 100 | +# Type checking |
| 101 | +npm run typecheck |
| 102 | + |
| 103 | +# Clean all generated files and caches |
| 104 | +npm run clear |
| 105 | +``` |
97 | 106 |
|
98 | | -## Learn More |
| 107 | +## 🚢 Deployment |
99 | 108 |
|
100 | | -- [Docusaurus Documentation](https://docusaurus.io/) |
101 | | -- [Migration Plan](../DOCUSAURUS_MIGRATION_PLAN.md) |
102 | | -- [Migration Status](../DOCUSAURUS_MIGRATION_STATUS.md) |
| 109 | +The site builds to static HTML/CSS/JS files that can be deployed to any static hosting service. The production build is in the `build/` directory after running `npm run build`. |
0 commit comments