|
| 1 | +# Project Overview |
| 2 | + |
| 3 | +This repository contains the source code for the documentation website for **Lumberjack**, a framework designed to "Supercharge your WordPress Development". The site is built using **Docusaurus**, a modern static website generator based on React. |
| 4 | + |
| 5 | +The project is configured with TypeScript and includes a versioning system to manage documentation for multiple releases of the Lumberjack framework. |
| 6 | + |
| 7 | +## Key Technologies |
| 8 | + |
| 9 | +- **Docusaurus:** Static site generator. |
| 10 | +- **React:** UI framework. |
| 11 | +- **TypeScript:** For type safety. |
| 12 | +- **Markdown (MDX):** For writing documentation content. |
| 13 | +- **GitHub Actions:** For CI/CD. |
| 14 | +- **Algolia:** For search functionality. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +# Development Workflow |
| 19 | + |
| 20 | +## Initial Setup |
| 21 | + |
| 22 | +To get started, clone the repository and install the dependencies using npm. |
| 23 | + |
| 24 | +```bash |
| 25 | +npm install |
| 26 | +``` |
| 27 | + |
| 28 | +## Running the Development Server |
| 29 | + |
| 30 | +To preview your changes as you edit the files, you can run the local development server. |
| 31 | + |
| 32 | +```bash |
| 33 | +npm start |
| 34 | +``` |
| 35 | + |
| 36 | +This command starts a local development server (usually on `http://localhost:3000`) and opens up a browser window. Most changes are reflected live without having to restart the server. |
| 37 | + |
| 38 | +## Building the Site |
| 39 | + |
| 40 | +To generate a static production build of the website, run the following command. |
| 41 | + |
| 42 | +```bash |
| 43 | +npm run build |
| 44 | +``` |
| 45 | + |
| 46 | +This command generates static content into the `build/` directory. |
| 47 | + |
| 48 | +## Linting and Type-Checking |
| 49 | + |
| 50 | +The project uses ESLint for linting and TypeScript for type-checking. The CI pipeline runs these checks on every pull request. |
| 51 | + |
| 52 | +```bash |
| 53 | +# Run the linter |
| 54 | +npm run lint |
| 55 | + |
| 56 | +# Check for TypeScript errors |
| 57 | +npm run typecheck |
| 58 | +``` |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +# Content and Versioning |
| 63 | + |
| 64 | +## Content Directory |
| 65 | + |
| 66 | +All documentation content is written in Markdown (`.md` or `.mdx`) and is located in the following directories: |
| 67 | + |
| 68 | +- **`docs/`**: Contains the documentation for the _next_ or _unreleased_ version of Lumberjack. |
| 69 | +- **`versioned_docs/`**: Contains snapshots of the documentation for previous, tagged versions of Lumberjack (e.g., `version-v8`, `version-v7`). |
| 70 | + |
| 71 | +## Sidebars |
| 72 | + |
| 73 | +The navigation structure for the documentation is defined in these files: |
| 74 | + |
| 75 | +- **`sidebars.ts`**: Defines the sidebar for the _next_ version. |
| 76 | +- **`versioned_sidebars/`**: Contains the sidebar configurations for each versioned documentation. |
| 77 | + |
| 78 | +## Docusaurus Commands for Versioning and Maintenance |
| 79 | + |
| 80 | +For Docusaurus-specific commands, we generally use the `npm run docusaurus` prefix. |
| 81 | + |
| 82 | +To create a new version of the documentation (e.g., when a new version of Lumberjack is released), use the following Docusaurus command: |
| 83 | + |
| 84 | +```bash |
| 85 | +npm run docusaurus docs:version <version_name> |
| 86 | +``` |
| 87 | + |
| 88 | +This will create a new versioned copy of the `docs/` and `sidebars.ts` files, making them specific to the new version. |
| 89 | + |
| 90 | +Other useful `docusaurus` commands include: |
| 91 | + |
| 92 | +- `npm run docusaurus deploy`: Deploys the site. |
| 93 | +- `npm run docusaurus clear`: Clears the build cache. |
| 94 | +- `npm run docusaurus serve`: Serves the built static site. |
| 95 | +- `npm run docusaurus write-translations`: Extracts text for internationalization. |
| 96 | +- `npm run docusaurus write-heading-ids`: Generates heading IDs for Markdown files. |
| 97 | +- `npm run docusaurus swizzle`: Ejects and customizes Docusaurus components. |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +# Deployment |
| 102 | + |
| 103 | +The website is automatically deployed to GitHub Pages via a GitHub Actions workflow defined in `.github/workflows/main.yml`. |
| 104 | + |
| 105 | +The workflow is triggered on every push to the `main` branch. It performs the following steps: |
| 106 | + |
| 107 | +1. **Lint:** Runs `npm run lint` to check for code style issues. |
| 108 | +2. **Build:** Runs `npm run typecheck` and `npm run build` to ensure the project builds successfully. |
| 109 | +3. **Deploy:** Deploys the contents of the `build` directory to the `gh-pages` branch. |
| 110 | +4. **Algolia Crawl:** Triggers a new crawl in Algolia to update the search index with the latest content. |
0 commit comments