mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-05 19:16:06 -06:00
2.6 KiB
2.6 KiB
Repository Guidelines
Project Structure & Module Organization
src/– app codecomponents/(React, PascalCase files),pages/(Astro/API routes),lib/(domain + utilities, kebab-case),hooks/,layouts/,styles/,tests/,types/,data/,content/.
scripts/– operational TS scripts (DB init, recovery): e.g.,scripts/manage-db.ts.drizzle/– SQL migrations;data/– runtime SQLite (gitea-mirror.db).public/– static assets;dist/– build output.- Key config:
astro.config.mjs,tsconfig.json(alias@/* → src/*),bunfig.toml(test preload),.env(.example).
Build, Test, and Development Commands
- Prereq: Bun
>= 1.2.9(seepackage.json). - Setup:
bun run setup– install deps and init DB. - Dev:
bun run dev– start Astro dev server. - Build:
bun run build– producedist/. - Preview/Start:
bun run preview(static preview) orbun run start(SSR entry). - Database:
bun run db:generate|migrate|push|studioandbun run manage-db init|check|fix|reset-users. - Tests:
bun test|bun run test:watch|bun run test:coverage. - Docker: see
docker-compose.ymland variants in repo root.
Coding Style & Naming Conventions
- Language: TypeScript, Astro, React.
- Indentation: 2 spaces; keep existing semicolon/quote style in touched files.
- Components: PascalCase
.tsxinsrc/components/(e.g.,MainLayout.tsx). - Modules/utils: kebab-case in
src/lib/(e.g.,gitea-enhanced.ts). - Imports: prefer alias
@/…(configured intsconfig.json). - Do not introduce new lint/format configs; follow current patterns.
Testing Guidelines
- Runner: Bun test (
bun:test) with preloadsrc/tests/setup.bun.ts(seebunfig.toml). - Location/Names:
**/*.test.ts(x)undersrc/**(examples insrc/lib/**). - Scope: add unit tests for new logic and API route tests for handlers.
- Aim for meaningful coverage on DB, auth, and mirroring paths.
Commit & Pull Request Guidelines
- Commits: short, imperative, scoped when helpful (e.g.,
lib: fix token parsing,ui: align buttons). - PRs must include:
- Summary, rationale, and testing steps/commands.
- Linked issues (e.g.,
Closes #123). - Screenshots/gifs for UI changes.
- Notes on DB/migration or .env impacts; update
docs//CHANGELOG if applicable.
Security & Configuration Tips
- Never commit secrets. Copy
.env.example→.envand fill values; preferbun run startup-env-configto validate. - SQLite files live in
data/; avoid committing generated DBs. - Certificates (if used) reside in
certs/; manage locally or via Docker secrets.