Registry
--------
src/domain/species/registry.ts previously hard-coded the species list,
which meant adding a new animal forced an edit in two places. The
registry now uses Vite's `import.meta.glob('./*/index.ts', { eager: true })`
and registers every manifest that default-exports a SpeciesManifest.
Duplicate ids log a warn and the first wins. Existing named imports
keep working — equine/index.ts adds `export default equine` next to the
named export.
The species dropdown is also now sorted alphabetically by labelFr (FR
locale) instead of insertion order, so two species don't shuffle
position based on glob ordering.
Scaffold script
---------------
`pnpm scaffold:species` (scripts/scaffold-species.mjs) is an
interactive Node ESM prompt that asks for the id, FR/EN labels, asset
folder, main SVG filename, detail SVG mappings, and the vertebral
formula, then writes:
src/domain/species/<id>/index.ts (with `export default`)
src/domain/species/<id>/vertebrae.ts
src/domain/species/<id>/pathologies.ts (Zod-parses the JSON)
src/domain/species/<id>/pathologies.json (minimal valid skeleton)
public/species/<assetFolder>/ (directory placeholder)
The script refuses to overwrite existing files, so it's safe to rerun
after typos. SVG assets are not generated — drop them in the public
folder yourself.
Findings JSON updates
---------------------
No runtime hot-reload mechanism is needed in dev: `pathologies.ts`
imports `pathologies.json` and runs `SpeciesFindingsSchema.parse(data)`
at module load, so a JSON edit triggers Vite HMR + an immediate Zod
validation pass. In prod, rebuild and redeploy.
Docs
----
docs/ADDING-A-SPECIES.md rewritten around the new flow: quick start via
the scaffold script first, manual instructions second, and removed the
stale references to the flat `Pathology[]` model and the no-longer-
required registry edit step.
Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.4 KiB
JSON
53 lines
1.4 KiB
JSON
{
|
|
"name": "osteo-report",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"description": "Single-praticien veterinary osteopathy report app with PDF export/import",
|
|
"license": "MIT",
|
|
"engines": {
|
|
"node": ">=20",
|
|
"pnpm": ">=9"
|
|
},
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "tsc -p tsconfig.json --noEmit && vite build",
|
|
"preview": "vite preview",
|
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
"test": "vitest",
|
|
"test:run": "vitest run",
|
|
"lint": "eslint . --max-warnings 0",
|
|
"format": "prettier --write .",
|
|
"scaffold:species": "node scripts/scaffold-species.mjs"
|
|
},
|
|
"dependencies": {
|
|
"@tailwindcss/vite": "^4.3.0",
|
|
"@vitejs/plugin-react-swc": "^3.7.2",
|
|
"canvg": "^4.0.2",
|
|
"motion": "^11.11.17",
|
|
"pdf-lib": "^1.17.1",
|
|
"react": "^19.0.0",
|
|
"react-dom": "^19.0.0",
|
|
"react-router-dom": "^7.1.1",
|
|
"vite": "^7.0.0",
|
|
"zod": "^3.24.1",
|
|
"zustand": "^5.0.2"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/jest-dom": "^6.6.3",
|
|
"@testing-library/react": "^16.1.0",
|
|
"@testing-library/user-event": "^14.5.2",
|
|
"@types/node": "^20.19.41",
|
|
"@types/react": "^19.0.1",
|
|
"@types/react-dom": "^19.0.1",
|
|
"eslint": "^9.17.0",
|
|
"eslint-plugin-react": "^7.37.3",
|
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
"globals": "^15.14.0",
|
|
"happy-dom": "^16.3.0",
|
|
"prettier": "^3.4.2",
|
|
"typescript": "^5.7.2",
|
|
"typescript-eslint": "^8.19.0",
|
|
"vitest": "^3.0.0"
|
|
}
|
|
}
|