|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `src/`: Lambda handler (`index.js`), helpers, resolvers, error handling, streaming. |
| 5 | +- `tests/`: Jest tests (`*.test.js`) and mocks. |
| 6 | +- `sam/`: AWS SAM templates. |
| 7 | +- `docs/`: Next.js site for documentation. |
| 8 | +- `scripts/`, `bin/`, `examples/`, `Dockerfile`, `Makefile`: tooling and examples. |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +- `npm test`: run Jest (watch locally; single run on CI). |
| 12 | +- `npm run test-coverage`: Jest with coverage. |
| 13 | +- `npm run lint` / `npm run lint-fix`: ESLint check/fix for `src/*.js`. |
| 14 | +- `npm run build`: `sam build -t sam/template.yml --use-container`. |
| 15 | +- `npm run deploy` / `npm run deploy-guided`: deploy via SAM using `deploy.yml`. |
| 16 | +- Make targets (advanced): `make aws-package`, `make aws-publish` (requires Docker and `AWS_PROFILE`). |
| 17 | + |
| 18 | +## Coding Style & Naming Conventions |
| 19 | +- JavaScript with 2‑space indentation, LF line endings, final newline (`.editorconfig`). |
| 20 | +- ESLint (Standard config). Key rules: semicolons required, object spacing, `prefer-const`, max lines per function warning. |
| 21 | +- Files in `src/` are small, single‑purpose modules. Tests live in `tests/` and end with `.test.js` (e.g., `helpers.test.js`). |
| 22 | + |
| 23 | +## Testing Guidelines |
| 24 | +- Framework: Jest; coverage from `src/**/*.js`; Node test environment. |
| 25 | +- Name tests descriptively (e.g., `index.v2.test.js`, `resolvers.test.js`). |
| 26 | +- Run: `npm test` (watch) or `npm test -- --runInBand` for CI‑like runs. Keep PRs from decreasing coverage. |
| 27 | + |
| 28 | +## Commit & Pull Request Guidelines |
| 29 | +- Branch from `main` (do not create `master`). Keep changes focused. |
| 30 | +- Commits: present‑tense summary + wrapped body; reference issues (e.g., “Closes #123”). |
| 31 | +- PRs must include: clear description, linked issues, tests, passing CI (CircleCI), and clean lint. Add screenshots for docs/UI changes when relevant. |
| 32 | + |
| 33 | +## Security & Configuration Tips |
| 34 | +- Core env vars: `tiffBucket`, `resolverTemplate`, `preflight`, `corsAllow*`, `forceHost`, `pyramidLimit`, `pageThreshold`, `density`, `debugBorder`. |
| 35 | +- S3 access uses AWS SDK v3; grant least‑privilege IAM to the source bucket. |
0 commit comments