feat(scenario): run logs, lint/format tooling, CONTRIBUTING
- add ScenarioRunLogEntity to persist step script output to DB - stepLogger dual-writes to NestJS logger and DB (fire-and-forget) - add GET /scenarios/:id/run/:runId returning run, stepRuns and logs - add POST /scenarios/:id/run/:runId/wait (polls until terminal state) - 9 new integration tests for the two endpoints (136 total) - add eslint with typescript-eslint and eslint-config-prettier - add npm scripts: format, lint, lint:fix - resolve all lint errors across src and test (no any types) - add CONTRIBUTING.md covering dev workflow
This commit is contained in:
+133
@@ -0,0 +1,133 @@
|
||||
# Contributing
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js 20+
|
||||
- Docker + Docker Compose
|
||||
|
||||
Install dependencies:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Copy `.env.example` to `.env` and fill in the required values before running.
|
||||
|
||||
---
|
||||
|
||||
## Starting the application
|
||||
|
||||
**Development** (watch mode, restarts on file changes):
|
||||
|
||||
```bash
|
||||
npm run start:dev
|
||||
```
|
||||
|
||||
**Production build, then start**:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
npm run start:prod
|
||||
```
|
||||
|
||||
The application listens on port **3000** by default.
|
||||
|
||||
---
|
||||
|
||||
## Running tests
|
||||
|
||||
```bash
|
||||
npm run test
|
||||
```
|
||||
|
||||
Run a single spec file:
|
||||
|
||||
```bash
|
||||
npm run test -- --no-coverage test/scenario.controller.spec.ts
|
||||
```
|
||||
|
||||
Watch mode:
|
||||
|
||||
```bash
|
||||
npm run test:watch
|
||||
```
|
||||
|
||||
Enable verbose NestJS log output during tests:
|
||||
|
||||
```bash
|
||||
npm run test:debug
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Formatting code
|
||||
|
||||
[Prettier](https://prettier.io/) is used to format all TypeScript source and test files:
|
||||
|
||||
```bash
|
||||
npm run format
|
||||
```
|
||||
|
||||
This rewrites `src/**/*.ts` and `test/**/*.ts` in place.
|
||||
|
||||
---
|
||||
|
||||
## Linting
|
||||
|
||||
[ESLint](https://eslint.org/) with `typescript-eslint` and `eslint-config-prettier` is used:
|
||||
|
||||
```bash
|
||||
# report issues
|
||||
npm run lint
|
||||
|
||||
# report and auto-fix where possible
|
||||
npm run lint:fix
|
||||
```
|
||||
|
||||
The project targets zero errors. Run lint before committing.
|
||||
|
||||
---
|
||||
|
||||
## Building the container
|
||||
|
||||
```bash
|
||||
docker compose build
|
||||
```
|
||||
|
||||
To rebuild without the layer cache:
|
||||
|
||||
```bash
|
||||
docker compose build --no-cache
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Running with Docker Compose
|
||||
|
||||
Start (detached):
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Build and start in one step:
|
||||
|
||||
```bash
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
The application is exposed at **http://localhost:13000**.
|
||||
|
||||
SQLite data is persisted in `./data/` and key files are mounted from `./keys/` — both directories are volume-mounted into the container.
|
||||
|
||||
Stop and remove containers:
|
||||
|
||||
```bash
|
||||
docker compose down
|
||||
```
|
||||
|
||||
View logs:
|
||||
|
||||
```bash
|
||||
docker compose logs -f
|
||||
```
|
||||
Reference in New Issue
Block a user