chore(workspace): move the app to apps/app under a pnpm workspace (step 2)
144 files moved with git mv (pure renames). Root package.json delegates dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager, root devDependency, engine-strict). Dockerfile builds @faunosteo/app on node:24-alpine and copies apps/app/dist; nginx and runtime config unchanged. CI workflow for Gitea Actions. packages/ reserved (README only). Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan. 271/271 tests, typecheck, lint, build green from the root.
This commit is contained in:
1 parent
c8d48ab4cc
commit
8673475293
164 files changed
+348
-128
No files matched your search
@@ -84,16 +84,22 @@ Name: Monorepo workspace
|
||||
Objective: Move the app to apps/app under a pnpm workspace with zero behaviour change; add CI.
|
||||
Dependencies: Step 1
|
||||
Changes expected:
|
||||
- apps/app/{src,public,tests,index.html,vite.config.ts,vitest.config.ts,tsconfig*.json,eslint.config.js,package.json}
|
||||
- root: pnpm-workspace.yaml (packages: apps/*, packages/*), package.json scripts delegating
|
||||
(pnpm -r typecheck/test:run/lint/build), shared prettier/editorconfig.
|
||||
- Dockerfile build context and paths updated; docker/nginx.conf and entrypoint.sh unchanged in behaviour.
|
||||
- CI pipeline file for the forge in use (none exists today): typecheck, lint, test, build, docker build.
|
||||
- packages/ directory created empty (no package yet; YAGNI).
|
||||
Tests: full suite green from apps/app; docker image builds and serves / and /pathology-editor.html.
|
||||
Manual validation: pnpm dev from root; open /, /new, /editor, /svg-editor, /editors, /pathology-editor.html; export a PDF; docker compose up --build and repeat on :8080.
|
||||
Definition of Done: identical behaviour, same test count, CI green on the branch, DEPLOY.md paths updated.
|
||||
Risks: path alias and Vite public dir regressions (caught by the e2e manual script); git history of moved files (use git mv in one commit).
|
||||
- apps/app/{src,public,tests,scripts,index.html,vite.config.ts,vitest.config.ts,tsconfig*.json,eslint.config.js,package.json}
|
||||
- root: pnpm-workspace.yaml (apps/*, packages/*), package.json scripts delegating
|
||||
(pnpm -r typecheck/test:run/lint/build), engines + packageManager, Node 24 pins.
|
||||
- Dockerfile build context and paths updated; docker/nginx.conf and entrypoint.sh unchanged.
|
||||
- CI pipeline (.gitea/workflows/ci.yml): install, typecheck, test, lint, build (+ docker job).
|
||||
- packages/ holds only a README (no empty package).
|
||||
Tests: full suite green from the root; dist contains the static editor and species assets.
|
||||
Manual validation: docs/development/WORKSPACE.md §6.
|
||||
Definition of Done: identical behaviour, same test count, CI file present, docs synced (WORKSPACE.md, CLAUDE.md, README, DEPLOY.md, CHANGELOG).
|
||||
Risks: path regressions (caught by the suite + dist listing); Docker build not verifiable on a host without a Docker daemon.
|
||||
Status: DONE 2026-10-08 (branch feature/step-02-monorepo-workspace, uncommitted, awaiting validation).
|
||||
Facts: 144 files moved with git mv; 271/271 tests, typecheck, lint, build green from the root;
|
||||
Node 24 LTS adopted (Node 20 EOL 2026-04-30); pnpm 10.13.1 pinned (packageManager + root devDependency);
|
||||
lockfile rewritten by pnpm 10.13.1 (libc fields left by an earlier pnpm 11 dropped).
|
||||
Side note: the gitflow finish of Step 1 purged docs/superpowers/{specs,plans} (lib rule BDR-065,
|
||||
commit 8f217d8 on develop); restore with `git revert 8f217d8` if those design records are wanted.
|
||||
```
|
||||
|
||||
```text
|
||||
@@ -498,7 +504,7 @@ Per-step table (depends on / unblocks / main risk):
|
||||
| Step | Depends on | Unblocks | Main risk |
|
||||
|---|---|---|---|
|
||||
| 1 Characterisation tests | 0 | 2, 4, 5 | encoding bugs as expected behaviour |
|
||||
| 2 Workspace | 1 | 3, 4 | path regressions |
|
||||
| 2 Workspace | 1 | 3, 4 | path regressions (DONE) |
|
||||
| 3 Supabase foundation | 2 | 7, 13 | hosting decision (Q2) |
|
||||
| 4 Sheet model + importer | 1, 2 | 5, 13 | special cases missed (audit 07) |
|
||||
| 5 App on sheet, document v3 | 4 | 6, 14, 17 | core refactor size |
|
||||
|
||||
@@ -137,7 +137,7 @@ cannot ship without migrating it, LOW means it is cosmetic or self-contained.
|
||||
| `docs/PATHOLOGIES-FORMAT.md` | REFACTOR | Becomes the `finding_tree` section of the sheet document spec. |
|
||||
| `docs/ADDING-A-SPECIES.md` | REPLACE | Species are created in the editor. |
|
||||
| `docs/PDF-FORMAT.md` | REPLACE | 12-line placeholder today; written for attachment v3. |
|
||||
| `docs/superpowers/*` | KEEP | Historical design records. |
|
||||
| `docs/superpowers/*` | REMOVED | Purged by the gitflow finish of Step 1 (lib rule BDR-065, commit 8f217d8). Recoverable from git history. |
|
||||
| `docs/faunosteo-audit/` | KEEP | Reference for the migration; frozen at `83e40af`. |
|
||||
| `docs/development/` | NEW | This set. |
|
||||
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
# Workspace
|
||||
|
||||
Status: plan Step 2, 2026-10-08. The repository is a pnpm workspace. The
|
||||
private application was moved under `apps/app` with `git mv` (history kept)
|
||||
and runs exactly as before; nothing else was extracted.
|
||||
|
||||
## 1. Structure
|
||||
|
||||
```text
|
||||
faunosteo/
|
||||
├─ apps/
|
||||
│ └─ app/ @faunosteo/app — Vite + React private application (the current app)
|
||||
│ ├─ src/ public/ tests/ scripts/ index.html
|
||||
│ ├─ vite.config.ts vitest.config.ts tsconfig*.json eslint.config.js
|
||||
│ └─ package.json app dependencies and scripts
|
||||
├─ packages/ shared code, empty on purpose (see packages/README.md)
|
||||
├─ docker/ nginx.conf, entrypoint.sh (unchanged)
|
||||
├─ docs/ conventions, audit, development plan
|
||||
├─ logos/ brand sources
|
||||
├─ .gitea/workflows/ci.yml CI (Gitea Actions)
|
||||
├─ Dockerfile builds apps/app, serves it with nginx (unchanged runtime)
|
||||
├─ docker-compose.yml .env.example
|
||||
├─ package.json workspace root: scripts, engines, packageManager
|
||||
├─ pnpm-workspace.yaml apps/*, packages/*, approved build scripts
|
||||
├─ pnpm-lock.yaml single lockfile for the whole workspace
|
||||
├─ .nvmrc .node-version Node 24
|
||||
└─ .npmrc supply-chain guard, engine-strict
|
||||
```
|
||||
|
||||
Future units, created only by the step that needs them:
|
||||
|
||||
| Path | Role | Created at |
|
||||
|---|---|---|
|
||||
| `apps/public-web` | SSR public site (landing, practitioner profiles, search) | plan Step 22 |
|
||||
| `apps/worker` | Node job runner (emails, expiry, calendar sync, imports) | plan Step 19 |
|
||||
| `packages/*` | shared domain, anatomy, pdf, i18n, supabase, config, ui | see `packages/README.md` |
|
||||
| `supabase/` | migrations, functions, seed, tests | plan Step 3 |
|
||||
|
||||
## 2. Why this layout now
|
||||
|
||||
- Root commands stay one word (`pnpm test:run`) and delegate with `pnpm -r`; a developer never needs to `cd`.
|
||||
- Docker builds one filtered package (`pnpm --filter @faunosteo/app build`) and copies `apps/app/dist`; adding `public-web` or `worker` later is a second stage, not a rewrite of the Dockerfile.
|
||||
- The lockfile was already v9 (workspace-capable); it now has one importer per package.
|
||||
- Moving 144 files while the app is small costs one commit; doing it after packages and a second app exist would not.
|
||||
|
||||
Alternatives weighed in `FRONTEND_ARCHITECTURE.md` §2 (app kept at root, single Next.js app): rejected.
|
||||
|
||||
## 3. Node and pnpm
|
||||
|
||||
| Tool | Version | Declared in |
|
||||
|---|---|---|
|
||||
| Node | 24 (LTS) | `.nvmrc`, `.node-version`, `package.json` `engines.node` `>=22.12 <25`, `Dockerfile` `node:24-alpine`, CI `node-version-file` |
|
||||
| pnpm | 10.13.1 | `package.json` `packageManager`, `engines.pnpm` `>=10.13 <11`, root `devDependencies.pnpm` (so `node_modules/.bin/pnpm` exists for the root scripts), `Dockerfile` `corepack prepare pnpm@10.13.1` |
|
||||
|
||||
Why Node 24: Node 20 reached end-of-life on 2026-04-30, the development host
|
||||
already runs 24, and every check of Steps 1 and 2 ran on 24.21.0.
|
||||
Why pnpm 10.x and not 11: pnpm 11 requires Node ≥ 22.13 *and* rewrites the
|
||||
lockfile; 10.13.1 is the version the Dockerfile was validated with (BLK-005).
|
||||
`engine-strict=true` in `.npmrc` makes `pnpm install` refuse a wrong Node, so
|
||||
the mismatch is visible at the first command instead of in a test.
|
||||
|
||||
Bootstrapping without a global install:
|
||||
|
||||
```bash
|
||||
corepack enable # once per machine; picks pnpm@10.13.1 from package.json
|
||||
pnpm install # or: corepack pnpm install
|
||||
```
|
||||
|
||||
If `corepack enable` cannot write to the Node bin directory, every command also
|
||||
works as `corepack pnpm <cmd>`.
|
||||
|
||||
## 4. Commands (from the root)
|
||||
|
||||
| Command | Does |
|
||||
|---|---|
|
||||
| `pnpm install` | installs the whole workspace from the lockfile |
|
||||
| `pnpm dev` | Vite dev server of `apps/app` on :5173 |
|
||||
| `pnpm preview` | serves `apps/app/dist` on :4173 |
|
||||
| `pnpm typecheck` | `tsc --noEmit` in every package |
|
||||
| `pnpm test:run` | vitest once in every package |
|
||||
| `pnpm test` | vitest watch for `apps/app` |
|
||||
| `pnpm lint` | ESLint, 0 warnings, in every package |
|
||||
| `pnpm build` | typecheck + Vite build in every package |
|
||||
| `pnpm check` | typecheck, test:run, lint, build in sequence (what CI runs) |
|
||||
| `pnpm format` | Prettier on the whole repository |
|
||||
| `pnpm scaffold:species` | legacy species scaffold (slated for removal) |
|
||||
|
||||
Package-scoped: `pnpm --filter @faunosteo/app <script>`.
|
||||
|
||||
## 5. Conventions
|
||||
|
||||
- A package has `name` `@faunosteo/<name>`, `private: true` for apps, its own
|
||||
`tsconfig.json`, tests under `tests/` (apps) or beside sources (packages).
|
||||
- Dependencies are declared where they are used (`apps/app/package.json`);
|
||||
the root holds only repository tooling (Prettier, pnpm).
|
||||
- Build scripts of dependencies run only for packages listed in
|
||||
`pnpm-workspace.yaml` `onlyBuiltDependencies`.
|
||||
- Commit scopes gain `app`, `workspace`, `ci` (see CLAUDE.md).
|
||||
|
||||
## 6. Manual validation procedure (Step 2)
|
||||
|
||||
1. From a clean clone, Node 24 active: `pnpm install` completes with no
|
||||
"Ignored build scripts" warning.
|
||||
2. `pnpm typecheck`, `pnpm test:run` (271 tests), `pnpm lint`, `pnpm build`
|
||||
all exit 0; `apps/app/dist/` contains `index.html`, `env.js`,
|
||||
`pathology-editor.html`, `species/equine/{Horse.svg,Horse_head.svg,pathologies.json}`.
|
||||
3. `pnpm dev`, then in the browser: `/` (home), `/new` (form, species defaults
|
||||
to Cheval), `/editor` (SVG loads, click a hinge, a hip, a spine zone, the
|
||||
head trigger; pickers open; findings picker lists the zone), export the
|
||||
PDF, go back to `/` and import it; `/svg-editor` loads a project SVG;
|
||||
`/pathology-editor.html` loads the pre-wired horse. Behaviour must match
|
||||
`CHARACTERIZATION_REPORT.md`.
|
||||
4. `grep -rn "/home/\|/Users/" apps/app/tests` returns nothing (no
|
||||
machine-specific path; fixtures resolve from `import.meta.url`).
|
||||
5. `docker build -t faunosteo .` then `docker compose up` and
|
||||
`curl -sI http://127.0.0.1:8080/` returns 200, `/env.js` carries
|
||||
`window.__APP_CONFIG__`.
|
||||
Reference in new issue
Block a user