tscmon
v0.1.5
Published
tsc wrapper that removes excess files from dist
Downloads
888
Maintainers
Readme
tscmon
Compile TypeScript while deleting any stale/excess files at the destination.
A small tsc wrapper.
Installation
npm install -D tscmon
Usage
npx tscmon or tscmon in a package.json script (faster)
Requirements
- Node >= 20
- TypeScript >= 5, resolved from your project
Options
| Flag | Default | |
|---|---|---|
| -p, --project <path> | ./tsconfig.json | tsconfig file, or a directory containing one |
| -c, --config <path> | auto-discovered | tscmon config file |
| --compiler <path> | local resolution | explicit compiler binary to spawn |
| --no-watch, --once | | build once and exit; watch mode is the default |
| --no-delete | | don't delete excess files in the output location |
| --full | | discard the buildinfo and build from scratch |
| --pretty | if TTY | [passthrough] colour and code frames in diagnostics; plain when piped or redirected |
| --no-emit, --noEmit | | type-check only; produces no output, so deletes nothing |
| --no-check, --noCheck | | [passthrough] emit without full type checking |
| --debounce <ms> | 100 | quiet period before reconciling |
| --ignore <glob> | | do not delete files matching this glob, relative to outDir (repeatable) |
| --on-first-build[:restart] <cmd> | | run a command on the first build of the session |
| --on-build[:restart] <cmd> | | run a command on every build |
| --on-first-success[:restart] <cmd> | | run a command on the first build that succeeded |
| --on-success[:restart] <cmd> | | run a command on every build that succeeded |
| --on-failure[:restart] <cmd> | | run a command on every build that reported errors |
| --info | | additional information from tsc and tscmon |
| --list-emitted-files, --listEmittedFiles | | [passthrough] show each file the compiler wrote; implied by --info |
| -h, --help | | show usage |
| -v, --version | | show the version |
<event>:restart supervises the command as a long-running child, stopped and respawned on the next trigger rather than run alongside.
Config file
Optional. tscmon.config.js, .mjs, .cjs, .json, or a tscmon key in package.json. CLI flags win.
// @ts-check
/** @satisfies {import('tscmon').TscmonConfig} */
const config = {
project: 'tsconfig.json',
ignore: ['assets/**'],
onSuccess: { command: 'node dist/server.js', restart: true },
onFailure: 'echo build failed',
}
export default config