|
| 1 | +--- |
| 2 | +sidebar_position: 2 |
| 3 | +--- |
| 4 | + |
| 5 | +# Installation & Development |
| 6 | + |
| 7 | +Get started with TeXlyre development in minutes. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +- **Node.js** 18 or higher |
| 12 | +- **Modern browser** with File System Access API support (Chrome, Edge recommended) |
| 13 | +- **Git** for cloning the repository |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +Clone the repository and install dependencies: |
| 18 | + |
| 19 | +```bash npm2yarn |
| 20 | +git clone https://github.com/TeXlyre/texlyre.git |
| 21 | +cd texlyre |
| 22 | +npm install |
| 23 | +``` |
| 24 | + |
| 25 | +## Development Commands |
| 26 | + |
| 27 | +### Quick Start |
| 28 | + |
| 29 | +Run the production build locally with tests: |
| 30 | + |
| 31 | +```bash npm2yarn |
| 32 | +npm run start |
| 33 | +``` |
| 34 | + |
| 35 | +This command: |
| 36 | +1. Builds the production version |
| 37 | +2. Runs all tests |
| 38 | +3. Starts a local preview server (on port `:4173`) |
| 39 | + |
| 40 | +### Development Server |
| 41 | + |
| 42 | +Start the development server with hot reload: |
| 43 | + |
| 44 | +```bash npm2yarn |
| 45 | +npm run dev |
| 46 | +``` |
| 47 | + |
| 48 | +Access the application at `http://localhost:5173` |
| 49 | + |
| 50 | +### HTTPS Development |
| 51 | + |
| 52 | +For testing WebRTC features that require HTTPS: |
| 53 | + |
| 54 | +```bash npm2yarn |
| 55 | +npm run dev:https |
| 56 | +``` |
| 57 | + |
| 58 | +Access the application at `https://localhost:5173` |
| 59 | + |
| 60 | +## Build Commands |
| 61 | + |
| 62 | +### Development Build |
| 63 | + |
| 64 | +Fast build for local testing: |
| 65 | + |
| 66 | +```bash npm2yarn |
| 67 | +npm run build |
| 68 | +``` |
| 69 | + |
| 70 | +### Production Build |
| 71 | + |
| 72 | +Full production build with all optimizations: |
| 73 | + |
| 74 | +```bash npm2yarn |
| 75 | +npm run build:prod |
| 76 | +``` |
| 77 | + |
| 78 | +This includes: |
| 79 | +- Config generation |
| 80 | +- Service worker versioning |
| 81 | +- Plugin index generation |
| 82 | +- Font manifest generation |
| 83 | +- TypeScript compilation |
| 84 | +- Vite production build |
| 85 | + |
| 86 | +### Preview Production Build |
| 87 | + |
| 88 | +Preview the production build locally: |
| 89 | + |
| 90 | +```bash npm2yarn |
| 91 | +npm run preview |
| 92 | +``` |
| 93 | + |
| 94 | +## Testing |
| 95 | + |
| 96 | +### Run All Tests |
| 97 | + |
| 98 | +```bash npm2yarn |
| 99 | +npm run test |
| 100 | +``` |
| 101 | + |
| 102 | +### Watch Mode |
| 103 | + |
| 104 | +Run tests in watch mode during development: |
| 105 | + |
| 106 | +```bash npm2yarn |
| 107 | +npm run test:watch |
| 108 | +``` |
| 109 | + |
| 110 | +### Coverage Report |
| 111 | + |
| 112 | +Generate test coverage report: |
| 113 | + |
| 114 | +```bash npm2yarn |
| 115 | +npm run test:coverage |
| 116 | +``` |
| 117 | + |
| 118 | +### Specific Test Suites |
| 119 | + |
| 120 | +Run specific test categories: |
| 121 | + |
| 122 | +```bash npm2yarn |
| 123 | +npm run test:unit |
| 124 | +npm run test:integration |
| 125 | +npm run test:components |
| 126 | +npm run test:services |
| 127 | +``` |
| 128 | + |
| 129 | +### CI Tests |
| 130 | + |
| 131 | +Run tests in CI mode (used by GitHub Actions): |
| 132 | + |
| 133 | +```bash npm2yarn |
| 134 | +npm run test:ci |
| 135 | +``` |
| 136 | + |
| 137 | +## Code Quality |
| 138 | + |
| 139 | +### Linting |
| 140 | + |
| 141 | +Check code quality with ESLint: |
| 142 | + |
| 143 | +```bash npm2yarn |
| 144 | +npm run lint |
| 145 | +``` |
| 146 | + |
| 147 | +### Auto-fix |
| 148 | + |
| 149 | +Fix linting issues and format code: |
| 150 | + |
| 151 | +```bash npm2yarn |
| 152 | +npm run clean |
| 153 | +``` |
| 154 | + |
| 155 | +This runs ESLint with auto-fix and Biome formatter. |
| 156 | + |
| 157 | +## Utility Commands |
| 158 | + |
| 159 | +### Clear Cache |
| 160 | + |
| 161 | +Clear build and cache directories: |
| 162 | + |
| 163 | +```bash npm2yarn |
| 164 | +npm run clean:cache |
| 165 | +``` |
| 166 | + |
| 167 | +### Generate Configs |
| 168 | + |
| 169 | +Generate configuration files: |
| 170 | + |
| 171 | +```bash npm2yarn |
| 172 | +npm run generate-configs |
| 173 | +``` |
| 174 | + |
| 175 | +### Generate Plugin Index |
| 176 | + |
| 177 | +Regenerate the plugin registry: |
| 178 | + |
| 179 | +```bash npm2yarn |
| 180 | +npm run generate-plugins |
| 181 | +``` |
| 182 | + |
| 183 | +### Generate Font Manifest |
| 184 | + |
| 185 | +Regenerate the font manifest: |
| 186 | + |
| 187 | +```bash npm2yarn |
| 188 | +npm run generate-fonts |
| 189 | +``` |
| 190 | + |
| 191 | +## Common Workflows |
| 192 | + |
| 193 | +### First-Time Setup |
| 194 | + |
| 195 | +```bash npm2yarn |
| 196 | +git clone https://github.com/TeXlyre/texlyre.git |
| 197 | +cd texlyre |
| 198 | +npm install |
| 199 | +npm run dev |
| 200 | +``` |
| 201 | + |
| 202 | +### Before Committing |
| 203 | + |
| 204 | +```bash npm2yarn |
| 205 | +npm run clean |
| 206 | +npm run test |
| 207 | +``` |
| 208 | + |
| 209 | +### Local Production Testing |
| 210 | + |
| 211 | +```bash npm2yarn |
| 212 | +npm run start |
| 213 | +``` |
| 214 | + |
| 215 | +### Debugging WebRTC Features |
| 216 | + |
| 217 | +```bash npm2yarn |
| 218 | +npm run dev:https |
| 219 | +``` |
| 220 | + |
| 221 | +Then open `https://localhost:5173` in your browser. |
| 222 | + |
| 223 | +## Troubleshooting |
| 224 | + |
| 225 | +### Port Already in Use |
| 226 | + |
| 227 | +If port 5173 is already in use, Vite will automatically try the next available port (5174, 5175, etc.). |
| 228 | + |
| 229 | +### HTTPS Certificate Warnings |
| 230 | + |
| 231 | +When using `npm run dev:https`, your browser will show a security warning for the self-signed certificate. This is expected for local development. Click "Advanced" and proceed to the site. |
| 232 | + |
| 233 | +### Build Failures |
| 234 | + |
| 235 | +If you encounter build failures: |
| 236 | + |
| 237 | +1. Clear the cache: `npm run clean:cache` |
| 238 | +2. Remove `node_modules`: `rm -rf node_modules` |
| 239 | +3. Reinstall dependencies: `npm install` |
| 240 | +4. Try building again: `npm run build:prod` |
| 241 | + |
| 242 | +### Test Failures |
| 243 | + |
| 244 | +If tests fail: |
| 245 | + |
| 246 | +1. Ensure all dependencies are installed |
| 247 | +2. Clear Jest cache: `npx jest --clearCache` |
| 248 | +3. Run tests again: `npm run test` |
0 commit comments