# clinic service ui

## Requirements

- Node.js >= 18.16.0
- pnpm >= 8.15.0

## Run

### Dev

1. install pnpm: `npm install -g pnpm`
1. `pnpm i`
1. `pnpm dev`

If you want to start dev with mocking APIs before the backend ready, you can run `pnpm dev:msw` instead of `pnpm dev`.

### Build

1. `pnpm build`

`packages/slow-log-explorer` builds static assets into `packages/clinic-web/public/slow-log-explorer-app/` during `pnpm build`. CI rebuilds these assets, so generated files in that directory should not be committed.

The Docker release image is built from the rebuilt `packages/clinic-web/dist`.

## Tech Stack

1. pnpm
1. esbuild
1. tailwindcss
1. swr
1. react-router v6
1. antd
1. css variables
1. css grid
1. react-i18next

## How to Release

Branch model:

- `main` is the code trunk.
- `release` is the release trunk. It contains the released code plus release-only files such as `docker/release-version` and `changelog/`.

Normal code merge and release flow:

1. Update `main`, branch from `main`, and make the code change.
1. Commit and push the branch, then open a PR targeting `main`.
1. After the PR merges, the code is on the main trunk.
1. When a release is needed, update both `main` and `release`, check out `release`, and create a `release-YYYYMMDD.XX` branch. The branch suffix must match the version written to `docker/release-version`.
1. Merge `main` into the release branch. If source-code conflicts occur, resolve them with the `main` implementation unless the conflict is in release-only metadata.
1. Update `docker/release-version`. Keep the first line as exactly one comment line, then put the version on the next line. The version format is `YYYYMMDD.XX`, for example `20260623.01`, where `XX` is the release sequence for that day.
1. Update `changelog/`.
1. Commit and push the release branch, then open a PR targeting `release`.

Hotfix flow:

1. Check out `main`, update it, and branch from `main` for the hotfix.
1. Make the fix.
1. Commit and push the branch, then open a PR targeting `main`.
1. Prepare the release hotfix PR:
   - Check out `release` and update it.
   - Create a hotfix release branch.
   - Cherry-pick the just-merged hotfix PR changes.
   - Update `docker/release-version` and `changelog/`.
1. Commit and push the hotfix release branch, then open a PR targeting `release`.
