π Commands
General Commandsβ
mostir initβ
Initialize a mostir.config.mjs in the project root.
Options
--force, -f
Overwrite existing config file.
Note
- The
buildsection inmostir.config.mjsfollows esbuild options.
mostir buildβ
Run esbuild with the given config.
Options
--sync, -s
Run sync before build (cannot be used with--clean).--clean, -c
Run clean before build (cannot be used with--sync).--verbose, -v
Show detailed logs (only works with--sync).
Note
- β οΈ
--syncand--cleancannot be used together. - The behavior of
--syncand--cleanis the same as runningmostir syncandmostir clean.
β See Outdir-only Commands for limitations and details ofsyncandclean.
Outdir-only Commandsβ
The following limitations apply to both sync and clean:
outfile(single file output) is not supported.- Only
outdirbuilds are compatible. - When used with
mostir build:
mostir build --sync # runs sync, then build
mostir build --clean # runs clean, then build
--syncand--cleancannot be used together.
Comparison: sync vs cleanβ
| Command | Behavior | Use case | Safety |
|---|---|---|---|
| sync | Incrementally updates dist dir to match source dir (outbase or /src). Syncs non-TS files and removes orphan outputs (e.g. .js, .d.ts, maps) when their .ts sources are deleted. | Keep build output consistent without wiping everything. | β Safer (incremental cleanup) |
| clean | Empties the entire dist dir at once (ignores outbase). | Reset dist dir completely before a fresh build. | β οΈ Destructive (full wipe, cannot be undone) |
mostir syncβ
Synchronize dist dir with source dir (removes orphan files).
Requirements
- In
mostir.config.mjs, thebuildsection must specifyoutdir. - If
outbaseis not set, it defaults to/src. - If neither
outbasenor/srcexists,synccannot run.
Mechanism
- Compares files in
dist dirwithsource dir(outbaseor/src). - Syncs non-TS files into
dist dir. - Removes orphan files in
dist dir, including:- Non-TS files deleted from
source dir. - TS outputs left behind after deletion of
.tsinsource dir:.js.js.map.d.ts.d.ts.map
- Non-TS files deleted from
Example
- If
/src/foo.tsis deleted, thenoutdir/foo.js,foo.d.ts, andfoo.js.mapwill be removed.
Options
--verbose, -vShow detailed sync log.
mostir cleanβ
Clear all files inside dist dir.
Requirements
- In
mostir.config.mjs, thebuildsection must specifyoutdir.
Mechanism
- Empties the entire
dist dirat once (ignoresoutbase). - β οΈ This operation cannot be undone.
Options (none)