|
| 1 | +# RaBe Backstage – Copilot Instructions |
| 2 | + |
| 3 | +This is the [Backstage](https://backstage.io/) instance for Radio Bern RaBe. |
| 4 | +It contains catalog, TechDocs, and RaBe SSO integration via Keycloak OIDC. |
| 5 | + |
| 6 | +## Repository Structure |
| 7 | + |
| 8 | +- `packages/app/` – React frontend (Backstage app) |
| 9 | +- `packages/backend/` – Node.js backend |
| 10 | +- `plugins/` – Custom Backstage plugins (e.g. `permission-backend-module-rabe`, `catalog-backend-module-transformer`) |
| 11 | +- `docs/` – MkDocs-based documentation |
| 12 | +- `app-config.yaml` – Main Backstage config |
| 13 | +- `app-config.production.yaml` – Production overrides |
| 14 | + |
| 15 | +## Development Flow |
| 16 | + |
| 17 | +Install dependencies: |
| 18 | + |
| 19 | +```sh |
| 20 | +yarn install |
| 21 | +``` |
| 22 | + |
| 23 | +Start the app (frontend + backend): |
| 24 | + |
| 25 | +```sh |
| 26 | +yarn start |
| 27 | +``` |
| 28 | + |
| 29 | +## Build, Test & Validate |
| 30 | + |
| 31 | +```sh |
| 32 | +# TypeScript type-check |
| 33 | +yarn tsc |
| 34 | + |
| 35 | +# Run unit tests |
| 36 | +yarn test |
| 37 | + |
| 38 | +# Run all unit tests with coverage |
| 39 | +yarn test:all |
| 40 | + |
| 41 | +# Lint changed files (since origin/main) |
| 42 | +yarn lint |
| 43 | + |
| 44 | +# Lint all files |
| 45 | +yarn lint:all |
| 46 | + |
| 47 | +# Build backend |
| 48 | +yarn build:backend |
| 49 | + |
| 50 | +# Build everything |
| 51 | +yarn build:all |
| 52 | + |
| 53 | +# Run Playwright e2e tests (requires Chromium) |
| 54 | +npx playwright install --with-deps chromium |
| 55 | +npx playwright test |
| 56 | +``` |
| 57 | + |
| 58 | +## Code Standards |
| 59 | + |
| 60 | +- **Language**: TypeScript throughout; follow existing patterns in each package |
| 61 | +- **License**: GNU AGPL-3.0-only — include the SPDX identifier in new files where applicable |
| 62 | +- **Formatting**: Prettier (config from `@backstage/cli/config/prettier`); run `prettier --write .` or let `lint-staged` handle it |
| 63 | +- **Linting**: ESLint with Backstage's default config (`.eslintrc.js`) |
| 64 | +- **Commits**: Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) |
| 65 | + - `fix:` → PATCH release |
| 66 | + - `feat:` → MINOR release |
| 67 | + - `BREAKING CHANGE:` footer → MAJOR release |
| 68 | + - Other types (e.g. `chore:`, `docs:`, `refactor:`) do not trigger a release |
| 69 | + - Releases are automated via [go-semantic-release](https://go-semantic-release.xyz/) (see <https://go-semantic-release.xyz/llms.txt>) |
| 70 | + |
| 71 | +## Key Guidelines |
| 72 | + |
| 73 | +1. Keep changes minimal and surgical — avoid unrelated modifications |
| 74 | +2. Write unit tests for new functionality; place them alongside the source file as `*.test.ts` / `*.test.tsx` |
| 75 | +3. Playwright e2e tests live in `packages/app/e2e-tests/` |
| 76 | +4. Use `yarn backstage-cli versions:bump` to update Backstage dependencies |
| 77 | +5. New plugins go in `plugins/` and must be added to the relevant workspace package |
| 78 | +6. Container image is published from `Dockerfile` via CI; do not break the Docker build |
0 commit comments