Add and remove components
These CLI commands copy components into your app, show what they contain, and take them out again. Run them from your project folder, after init.
add
Copies components, and the components they need, into your app.
Each component goes into <components>/<name>/. With no names, it shows a checklist. Without a terminal, there's no checklist, so name the components.
- Dependencies come too. Adding
buttonalso addsspinner, and the CLI prints what it added. - Imports are rewritten.
cn()and the animation helpers are imported from@blotch/dolan/utils/cnand@blotch/dolan/utils/animate. - Existing components are kept. If a folder already exists, it asks before overwriting (default No), and skips it otherwise.
- Without a terminal, it skips it, and says how to overwrite it.
--forceoverwrites without asking.- Overwriting also deletes the files an older version copied that the bundled source no longer has.
- npm packages are installed. If a component imports a package your
package.jsonlacks,addinstalls it. It uses your package manager (npm, pnpm, yarn or bun, detected from the lockfile).class-variance-authorityfor Alert, Badge, Button, Button Group, Toggle and Typography.@tanstack/charts,d3-shapeand@types/d3-shapeforchartand the chart presets.
Unit tests
- They're copied only if you can run them. A component's tests (
<name>.test.ts, and one per other file it has) render it with@blotch/angular-lynx-testing-library. Soaddcopies them only when yourpackage.jsonlists the library. - Otherwise
addleaves them out and says so. Runng generate @blotch/angular-lynx:add-testing, thendolan updateadds them. - Their helpers come from
@blotch/dolan/testing/*. - They cover the code fully. Under
ng test --coverage, each component's own tests cover all of its files, with nothing left out. So you can keep the copies in your coverage report and its thresholds.
info
Prints a component's files, the components it depends on, and the components that use it.
It works without a dolan.config.json. With one, it also shows what's installed.
remove
Deletes a component's folder and its lockfile entry.
Alias: rm.
- If other installed components depend on it, it warns and asks first (default No). Without a terminal, it stops with exit code 1 instead.
- It offers to remove dependencies that nothing else uses (default Yes). Without a terminal, it removes them. It looks one level deep, so remove deeper dependencies yourself.
- It doesn't uninstall npm packages.
eject
Stops dolan tracking a component, so the component is yours.
It removes the component from dolan.lock.json and leaves its files alone. It asks first (default No). Without a terminal, it stops with exit code 1 unless you pass --force.
updatedoesn't touch it, even with--force.diffandoutdatedskip it.listshows it as ejected.- A component folder that isn't in
dolan.lock.jsoncounts as ejected, whatever put it there. - To track it again, run
dolan add <component>, which asks before overwriting it.
Related
- CLI:
init,theme,doctor, and how dolan works without a terminal - Check and update components:
list,diff,outdatedandupdate - UI Components: install dolan and add your first component
- Theming: the theme files
initcopies - Tailwind CSS: required by every component
