|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | + |
| 5 | +AdminLTE 4 is a Bootstrap 5 dashboard template with vanilla TypeScript components. |
| 6 | + |
| 7 | +- `src/ts/`: component behavior; `adminlte.ts` is the library entry point, and `util/` holds shared helpers. |
| 8 | +- `src/scss/`: Sass styles, component partials, mixins, and optional color themes. |
| 9 | +- `src/html/`: Astro demo/documentation pages and reusable Astro/MDX components. |
| 10 | +- `src/assets/`: source images and other static assets. |
| 11 | +- `src/config/`: Rollup, Astro, PostCSS, and asset-build configuration. |
| 12 | +- `tests/unit/`: unit tests and shared setup; `tests/a11y.mjs` checks built pages. |
| 13 | +- `dist/` and `src/html/public/`: generated output. Edit source files; exclude compiled `dist/` changes from contributor PRs. |
| 14 | + |
| 15 | +## Build, Test, and Development Commands |
| 16 | + |
| 17 | +Use Node.js 22.22.3+, 24.16.0+, or 26.3.0+ and npm 10+. Install with `npm ci`. |
| 18 | + |
| 19 | +- `npm start`: run asset watchers and the Astro dev server at `http://localhost:3000`. |
| 20 | +- `npm run build`: clean and rebuild CSS, JavaScript, declarations, assets, and demo/documentation HTML. |
| 21 | +- `npm run css` / `npm run js`: rebuild styles or JavaScript independently. |
| 22 | +- `npm run lint`: check ESLint, Stylelint, Astro, and lockfile rules. |
| 23 | +- `npm test`: run Vitest once; `npm run test-watch` enables watch mode. |
| 24 | +- `npm run production`: clean, lint, test, compile, and check local gzip budgets. |
| 25 | + |
| 26 | +## Coding Style & Naming Conventions |
| 27 | + |
| 28 | +Use two-space indentation, UTF-8, LF endings, and final newlines as defined in `.editorconfig`. Follow neighboring code and repository ESLint/Stylelint rules. Prettier is configured with single quotes, semicolons, and a 100-character line width; Astro has its own configuration. |
| 29 | + |
| 30 | +Use strict TypeScript, PascalCase component classes, camelCase methods, and kebab-case component filenames such as `card-widget.ts`. Prefix Sass partials with `_`, and follow existing Bootstrap-compatible selectors and `data-lte-*` attributes. |
| 31 | + |
| 32 | +## Testing Guidelines |
| 33 | + |
| 34 | +Add behavior and regression tests as `tests/unit/<component>.test.ts`. Vitest uses `happy-dom` and `tests/unit/setup.ts`; no numeric coverage threshold is configured. Cover DOM state, events, and cleanup where relevant. |
| 35 | + |
| 36 | +For UI changes, build first, then run `npm run test-a11y` and `npm run test-browser`. Install Chromium with `npx playwright install chromium`; set `BROWSERS=chromium,firefox,webkit` for all engines. Serious and critical axe violations fail the check. Review responsive layouts, dark mode, and RTL manually. |
| 37 | + |
| 38 | +## Commit & Pull Request Guidelines |
| 39 | + |
| 40 | +Follow the prevalent `type(scope): summary` commit format, for example `fix(header): prevent horizontal overflow`; common types include `feat`, `fix`, `docs`, and `chore`. |
| 41 | + |
| 42 | +Branch from and target `master`. Keep PRs focused, describe the behavior change, link relevant issues, and report validation commands/results. Include screenshots for visual changes. Follow `.github/CONTRIBUTING.md` and ensure third-party contributions are appropriately licensed. |
0 commit comments