| --- | |
| title: "start-docusaurus.py" | |
| slug: ScriptStartDocusaurus | |
| --- | |
| `start-docusaurus.py` starts the Docusaurus development server with automatic cleanup and process management. | |
| ## What It Does | |
| The script performs these operations before starting the server: | |
| 1. **Kills Existing Processes** - Automatically terminates any process running on port 3000 | |
| 2. **Clears Caches** - Removes `.docusaurus`, `build`, and `node_modules/.cache` directories | |
| 3. **Starts Fresh Server** - Launches the Docusaurus development server | |
| 4. **Cross-Platform** - Works on macOS, Linux, and Windows | |
| ## Usage | |
| ### Start the Server | |
| ```bash | |
| cd /path/to/juneau-docs | |
| python3 scripts/start-docusaurus.py | |
| ``` | |
| The server will start at `http://localhost:3000/` | |
| Press `Ctrl+C` to stop the server. | |
| ## When to Use | |
| Use this script when: | |
| - Starting development on documentation | |
| - The server is acting strangely (cache issues) | |
| - Need a clean server start | |
| - Testing documentation changes locally | |
| ## Requirements | |
| - Python 3.6 or higher | |
| - Node.js 18+ and npm | |
| - Dependencies installed (`npm install` in `juneau-docs` directory) | |
| - No external Python dependencies (uses only standard library) | |
| ## Notes | |
| - The script resolves its working directory relative to its own location (`scripts/../`), i.e. the `juneau-docs` repository root it lives in - it does not need to be run from any particular directory itself | |
| - Cache clearing is automatic - no flags needed | |
| - The server supports hot-reloading (changes appear immediately in browser) | |
| - Port 3000 must be available (script will kill existing processes) | |