0005. Switchable local vs published source for `@escolalms/components`
Generated from front/docs/adr/0005-switchable-local-or-published-components-source.md
- Status: Accepted (retroactive)
- Date: 2024-02-13
Context and Problem Statement
Section titled “Context and Problem Statement”Because UI lives in @escolalms/components (0004),
developing a front feature often meant: change Components, publish to npm, bump the front.
After the Vite migration (0010) path aliases
became resolvable through vite-tsconfig-paths.
Considered Options
Section titled “Considered Options”Not recorded.
Decision Outcome
Section titled “Decision Outcome”Two scripts toggle the source of the library:
switch_to_local_components.shremoves the npm package, adds its peer dependencies,git clonesEscolaLMS/componentsintofront/components/, copiestsconfig.paths.json.local(maps@escolalms/components/lib/*tocomponents/src/*) overtsconfig.paths.jsonand starts Vite.switch_to_prod_components.shrestores the npm package andtsconfig.paths.json.prod.
Consequences
Section titled “Consequences”- Good: front and component changes can be developed together with hot reload.
- Bad: the script mutates
package.json,yarn.lockandtsconfig.paths.json; forgetting to switch back before committing breaks CI. - Inferred: vendoring Components into the monorepo makes these scripts obsolete; a monorepo-era ADR (0100+) should record their replacement.
Evidence
Section titled “Evidence”9a075c592024-02-13 “local package”00ca63fc2024-02-13 “local package” -front/switch_to_local_components.sh472d97ca2024-02-13 “run local and prod components” -front/tsconfig.paths.json.local,front/tsconfig.paths.json.prod