tsc-clear
v1.0.9
Published
Clean up TypeScript dist output from stale compiled files (Windows only).
Maintainers
Readme
📦 Installation
Install globally via npm:
npm install -g tsc-clear🚀 Usage
Use tsc-clear after the TypeScript compilation step (tsc) and before running your compiled project:
{
"scripts": {
"start": "tsc && tsc-clear && node dist/index.js"
}
}🧹 What It Does
- Scans your
dist/(or configuredoutDir) directory - Looks for
.js,.js.map, and.d.tsfiles - Deletes those files if their corresponding
.tssource files no longer exist
This ensures your build directory is clean and free from outdated or orphaned artifacts that may cause bugs or unexpected behavior.
🔍 tsc-clear automatically detects your outDir from tsconfig.json, so no extra configuration is needed.
📌 Features
- 🧠 Smart scanning and cleanup without deleting everything
- 🚀 Fast and lightweight
- 🛠️ Built entirely in TypeScript
💬 Background
When developing with TypeScript, it's common to rename or delete files over time. But the TypeScript compiler (tsc) does not remove old .js, .d.ts, or .map files from the dist/ folder. This can lead to strange runtime issues or even crashes.
tsc-clear solves this by scanning your build output and cleaning up files that are no longer tied to a source .ts file.
🧠 Why Use tsc-clear?
- 🧹 Keeps your output directory clean
- ✅ Prevents stale files from causing runtime bugs
- ⚡ Improves your development experience with a tidy build
👨💻 Author
Created with ❤️ by Signor P
