npm-killer 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +140 -53
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,97 +1,184 @@
1
1
  # npm-killer
2
2
 
3
- Interactive CLI tool to find and kill Node.js processes running on ports. Unlike other port killers, this tool is designed to be **interactive and developer-friendly**.
3
+ [![npm version](https://img.shields.io/npm/v/npm-killer.svg)](https://www.npmjs.com/package/npm-killer)
4
+ [![npm downloads](https://img.shields.io/npm/dm/npm-killer.svg)](https://www.npmjs.com/package/npm-killer)
5
+ [![license](https://img.shields.io/npm/l/npm-killer.svg)](https://github.com/afzalbuilds/npm-killer/blob/main/LICENSE)
6
+ [![Node.js version](https://img.shields.io/node/v/npm-killer.svg)](https://nodejs.org)
4
7
 
5
- ## Features
8
+ > **Interactive CLI tool to find and kill Node.js processes running on ports** — Built for developers who run multiple services and need a visual, interactive way to manage port conflicts.
6
9
 
7
- - 🎯 **Interactive Mode** - Visual process selection with checkboxes
8
- - 🔍 **Smart Detection** - Finds only Node.js processes (node, npm, yarn, pnpm, bun)
9
- - 📋 **List Mode** - See all Node.js processes with their ports
10
- - ⚡ **Quick Kill** - Kill by port number or kill all at once
11
- - 🛡️ **Safe by Default** - Confirmation prompts before killing
12
- - 🎨 **Beautiful Output** - Color-coded, easy to read
10
+ ---
11
+
12
+ ## Why npm-killer?
13
+
14
+ Most port killers (`fuser`, `lsof`, `kill-port`) require you to know the exact PID or port upfront. **npm-killer** is different:
15
+
16
+ - 🎯 **Interactive by default** — Visual checkbox selection, no memorization needed
17
+ - 🔍 **Smart detection** — Finds Node.js, npm, yarn, pnpm, bun, Next.js processes automatically
18
+ - 📋 **Clean table output** — See all processes with ports at a glance
19
+ - ⚡ **Flexible modes** — Interactive, list, single-port, or kill-all
20
+ - 🛡️ **Safe by default** — Confirmation prompts prevent accidental kills
21
+ - 🎨 **Developer-friendly** — Color-coded, readable output
22
+
23
+ ---
13
24
 
14
25
  ## Installation
15
26
 
16
27
  ```bash
28
+ # Global install (recommended)
17
29
  npm install -g npm-killer
18
- ```
19
30
 
20
- Or use with npx:
21
- ```bash
31
+ # Or use without installing
22
32
  npx npm-killer
23
33
  ```
24
34
 
25
- ## Usage
35
+ **Requirements:** Node.js 18+, macOS / Linux / Windows (WSL)
36
+
37
+ ---
38
+
39
+ ## Quick Start
26
40
 
27
- ### Interactive Mode (Default)
28
41
  ```bash
42
+ # Interactive mode — select processes with spacebar, press Enter to kill
29
43
  npm-killer
30
- ```
31
- Shows a checklist of all Node.js processes with open ports. Select multiple processes with spacebar, press Enter to confirm.
32
44
 
33
- ### List Processes
34
- ```bash
35
- npm-killer --list
36
- # or
45
+ # List all Node.js processes with ports
37
46
  npm-killer -l
38
- ```
39
47
 
40
- ### Kill by Port
41
- ```bash
42
- npm-killer --port 3000
43
- # or
48
+ # Kill process on specific port (with confirmation)
44
49
  npm-killer -p 3000
45
- ```
46
50
 
47
- ### Kill All Node.js Processes
48
- ```bash
49
- npm-killer --all
50
- # or
51
- npm-killer -a
52
- ```
53
-
54
- ### Force Kill (No Confirmation)
55
- ```bash
56
- npm-killer --port 3000 --force
51
+ # Force kill on port (no confirmation)
57
52
  npm-killer -p 3000 -f
58
53
 
59
- npm-killer --all --force
54
+ # Kill all Node.js processes (with confirmation)
55
+ npm-killer -a
56
+
57
+ # Force kill all
60
58
  npm-killer -a -f
61
59
  ```
62
60
 
63
- ## Example Output
61
+ ---
64
62
 
65
- ```
63
+ ## Commands Reference
64
+
65
+ | Command | Alias | Description |
66
+ |---------|-------|-------------|
67
+ | `npm-killer` | | Interactive mode (default) |
68
+ | `npm-killer --list` | `-l` | List all Node.js processes with ports in a table |
69
+ | `npm-killer --port <port>` | `-p <port>` | Kill process on specific port |
70
+ | `npm-killer --all` | `-a` | Kill all detected Node.js processes |
71
+ | `npm-killer --force` | `-f` | Skip confirmation prompts |
72
+ | `npm-killer --version` | `-V` | Show version |
73
+ | `npm-killer --help` | `-h` | Show help |
74
+
75
+ ---
76
+
77
+ ## Output Examples
78
+
79
+ ### Interactive Mode (Default)
80
+ ```bash
66
81
  $ npm-killer
67
82
 
68
83
  Select processes to kill:
69
84
 
70
- ✓ 1. node (PID: 12345) - Ports: 3000, 3001
71
- ✓ 2. npm (PID: 12346) - Ports: 8080
72
- ──────────────
85
+ ✓ 1. node 32724 3001 node /path/to/server.ts
86
+ ✓ 2. next-server (v14.2.35) 48706 3000 next-server (v14.2.35)
87
+ ─────────────────────────────────────────────────────────────
73
88
  ◯ Kill ALL Node.js processes
74
89
  ◯ Exit without killing
75
90
 
76
91
  Kill 2 process(es)? (y/N) y
77
92
 
78
- ✓ Killed node (PID: 12345)
79
- ✓ Killed npm (PID: 12346)
93
+ ✓ Killed node (PID: 32724)
94
+ ✓ Killed next-server (v14.2.35) (PID: 48706)
80
95
  ```
81
96
 
82
- ## Why npm-killer?
97
+ ### List Mode (`-l`)
98
+ ```bash
99
+ $ npm-killer -l
100
+
101
+ Node.js Processes with Open Ports:
102
+
103
+ # Name PID Ports Command
104
+ ─── ────────────────────── ───── ───── ───────
105
+ 1 Code Helper (Plugin) 30509 62481 /Applications/VS Code/...
106
+ 2 node 32724 3001 node /project/server.ts
107
+ 3 next-server (v14.2.35) 48706 3000 next-server (v14.2.35)
108
+ 4 next-server (v16.1.1) 33053 3002 next-server (v16.1.1)
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Detected Process Types
114
+
115
+ npm-killer automatically detects and lists:
116
+
117
+ - **Node.js** — `node`, `node.js`
118
+ - **Package managers** — `npm`, `yarn`, `pnpm`, `bun`
119
+ - **Frameworks** — `next-server` (Next.js), `nuxt`, `vite`, `webpack-dev-server`
120
+ - **TypeScript runners** — `ts-node`, `tsx`, `nodemon`
121
+
122
+ ---
123
+
124
+ ## Use Cases
125
+
126
+ - **Microservices development** — Multiple services on different ports
127
+ - **Frontend + backend** — Next.js (3000), API (3001), WebSocket (3002)
128
+ - **CI/CD pipelines** — Clean up stray processes before deployments
129
+ - **Port conflicts** — Quickly identify and resolve `EADDRINUSE` errors
130
+ - **Team onboarding** — New developers can see running services instantly
131
+
132
+ ---
133
+
134
+ ## How It Works
83
135
 
84
- Existing tools like `fuser`, `lsof`, or `kill-port` require you to know the port or PID upfront. `npm-killer` is built for developers who:
85
- - Run multiple Node.js services and forget which is on which port
86
- - Want a visual overview before killing anything
87
- - Prefer interactive selection over memorizing commands
88
- - Work with npm, yarn, pnpm, bun - all detected automatically
136
+ 1. Uses `ps-list` to enumerate all running processes
137
+ 2. Filters for Node.js-related processes by name and command
138
+ 3. Uses `lsof` to detect listening TCP ports per PID
139
+ 4. Presents an interactive UI via `inquirer` or formatted table output
140
+ 5. Sends `SIGTERM` `SIGKILL` for graceful then forced termination
89
141
 
90
- ## Requirements
142
+ ---
91
143
 
92
- - Node.js 18+
93
- - macOS, Linux, or Windows (WSL)
144
+ ## Contributing
145
+
146
+ Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTING.md) first.
147
+
148
+ ```bash
149
+ # Clone and install
150
+ git clone https://github.com/afzalbuilds/npm-killer.git
151
+ cd npm-killer
152
+ npm install
153
+
154
+ # Run tests
155
+ npm test
156
+
157
+ # Build / test locally
158
+ npm pack
159
+ npm install -g ./npm-killer-*.tgz
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Author
165
+
166
+ **Muhammad Afzal** — Full-stack Developer & Open Source Enthusiast
167
+
168
+ - 🐦 **X (Twitter):** [@AfzalBuilds](https://x.com/AfzalBuilds)
169
+ - 🐙 **GitHub:** [afzalbuilds](https://github.com/afzalbuilds)
170
+ - 💼 **LinkedIn:** [afzalbuilds](https://www.linkedin.com/in/afzalbuilds/)
171
+ - 📺 **YouTube:** [@AfzalBuilds](https://www.youtube.com/@AfzalBuilds)
172
+ - 📘 **Facebook:** [AfzalBuilds](https://www.facebook.com/AfzalBuilds)
173
+
174
+ ---
94
175
 
95
176
  ## License
96
177
 
97
- MIT
178
+ MIT License — see [LICENSE](LICENSE) for details.
179
+
180
+ ---
181
+
182
+ **Made with ❤️ for developers who hate port conflicts.**
183
+
184
+ *Star this repo if it saved you time!* ⭐
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-killer",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Interactive CLI tool to kill Node.js processes on ports",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
@@ -32,4 +32,4 @@
32
32
  "node": ">=18.0.0"
33
33
  },
34
34
  "type": "module"
35
- }
35
+ }