@modelcity/cli
v1.0.7
Published
Build-time codegen CLI for Model City front-end projects: emits route shims, the composition root and the Tailwind source manifest for the modules selected in modules.config.mjs.
Downloads
197
Readme
@modelcity/cli
Build-time codegen CLI for Model City front-end projects.
modelcity gen reads the project's modules.config.mjs (the city's
declaration of contracted modules) and emits, for the enabled modules only:
- Route shims under
src/app/re-exporting each route from its@modelcity/*package — a disabled module's URLs 404 and its code never enters the bundle (Maven-reactor-style build-time selection). - The composition root (
src/lib/composition/registerModules.js) registering the enabled modules' i18n loaders, nav sections and home services into@modelcity/core. - The Tailwind source manifest (
src/styles/modules.css) importing the (possibly city-overridden) core stylesheet and adding one@sourceper enabled module, so component classes shipped innode_modulesare scanned.
All outputs are generated artifacts — git-ignore them and run the command on
predev/prebuild:
"scripts": {
"gen:modules": "modelcity gen",
"predev": "npm run gen:modules",
"prebuild": "npm run gen:modules"
}City overrides are read from ./overrides (or CITY_OVERRIDES_DIR): a file at
overrides/<module>/routes/… replaces or adds a route; non-route files are
overridden through the project's jsconfig paths fallback.
Part of the Model City release train — install every @modelcity/* package at
the same version. City projects scaffolded with npm create model-city-app
get all of this wiring out of the box.
Links
- Model City platform repository — architecture, the rest of the release train and the
create-model-city-apparchetype.
Author
Created and maintained by Jesús Pérez Melero, author of the Model City platform.
License
MIT — see LICENSE.
