aks-watcher
v1.0.2
Published
Simple file watcher using chokidar
Downloads
254
Readme
📦 aks-watcher
A lightweight, ESM-based file watcher built on Chokidar that automatically detects file changes and can run any command when a change occurs.
Perfect for simple dev workflows, script automation, or lightweight alternatives to tools like Nodemon.
🚀 Features
⚡ Real-time file watching
📁 Watches entire project (excluding
node_modules&.git)✏️ Detects add / change / delete
🔥 Run any command on change
🪟 Fully works on Windows (uses polling automatically)
📦 ESM native
🧹 Queues commands (no overlapping executions)
📥 Installation
Global install (recommended)
Bash
npm install -g aks-watcher Local install
Bash
npm install aks-watcher 🧪 Usage
Basic: Watch files
Bash
aks-watcher Run a command on every change
Bash
aks-watcher "npm run build" Example: Restart a node server
Bash
aks-watcher "node server.js" Example: Multiple commands
Bash
aks-watcher "npm run lint && npm run build" 📌 How it Works
aks-watcher listens to file events:
➕ add
✏️ change
❌ delete
📂 folder changes
And when a change occurs, your command is executed.
Commands are queued, meaning if you edit files too fast, it will wait for the current command to finish before running again.
⚙️ Internals / Behavior
Uses Chokidar v4 (ESM)
Automatically enables
usePolling: truefor Windows compatibilityIgnores:
node_modules.git
🗂 Directory Structure
Plaintext
aks-watcher/
│── bin/
│ └── index.js # CLI entry
│── src/
│ └── watcher.js # Main watcher logic
└── package.json 🧩 Example Output
Plaintext
🟢 AKS Watcher started...
📁 Watching: C:\project
✨ Watching for changes...
✏️ File changed: src/index.js
🚀 Executing: npm run build...
✔ Command finished. 🔧 CLI Arguments
| Argument | Description |
| --- | --- |
| "command" | The command to run on each file change |
Example:
Bash
aks-watcher "echo File updated!" 🛠 Roadmap
Add ignore patterns
--ignore logs,distWatch specific folders
--dir srcFilter by extension
--ext js,ts,jsonColored logs
Restart long-running processes
🧑💻 Author
Abhishek Singh
NPM: (aks-watcher)
GitHub: (Repo link)
📄 License
MIT License
