Skip to content

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

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.

Not recorded.

Two scripts toggle the source of the library:

  • switch_to_local_components.sh removes the npm package, adds its peer dependencies, git clones EscolaLMS/components into front/components/, copies tsconfig.paths.json.local (maps @escolalms/components/lib/* to components/src/*) over tsconfig.paths.json and starts Vite.
  • switch_to_prod_components.sh restores the npm package and tsconfig.paths.json.prod.
  • Good: front and component changes can be developed together with hot reload.
  • Bad: the script mutates package.json, yarn.lock and tsconfig.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.
  • 9a075c59 2024-02-13 “local package”
  • 00ca63fc 2024-02-13 “local package” - front/switch_to_local_components.sh
  • 472d97ca 2024-02-13 “run local and prod components” - front/tsconfig.paths.json.local, front/tsconfig.paths.json.prod