portcleaner 1.0.0 β 1.0.1
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.
- package/README.md +100 -107
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# π§Ή
|
|
1
|
+
# π§Ή PortCleaner CLI
|
|
2
2
|
|
|
3
3
|
Instantly kill stuck development servers and free your ports.
|
|
4
4
|
|
|
5
|
-
`
|
|
5
|
+
`portcleaner` is a lightweight CLI tool that scans your system for running development servers (Node, Bun, Deno, Python, Docker, etc.) and automatically releases the ports they are occupying.
|
|
6
6
|
|
|
7
7
|
No more:
|
|
8
8
|
|
|
@@ -10,19 +10,21 @@ No more:
|
|
|
10
10
|
EADDRINUSE: address already in use :::3000
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
π¦ npm package: [https://www.npmjs.com/package/portcleaner](https://www.npmjs.com/package/portcleaner)
|
|
14
|
+
|
|
13
15
|
---
|
|
14
16
|
|
|
15
|
-
##
|
|
17
|
+
## Table of Contents
|
|
16
18
|
|
|
17
19
|
* [Why this exists](#why-this-exists)
|
|
18
20
|
* [Features](#features)
|
|
19
21
|
* [Supported Platforms](#supported-platforms)
|
|
20
|
-
* [Quick Install (
|
|
21
|
-
* [Manual Installation (
|
|
22
|
+
* [Quick Install (Recommended)](#quick-install-recommended)
|
|
23
|
+
* [Manual Installation (For Contributors)](#manual-installation-for-contributors)
|
|
22
24
|
* [Usage](#usage)
|
|
23
|
-
* [
|
|
24
|
-
* [Uninstall / Disable
|
|
25
|
-
* [
|
|
25
|
+
* [Use inside your project](#use-inside-your-project)
|
|
26
|
+
* [Uninstall / Disable](#uninstall--disable)
|
|
27
|
+
* [Reinstall later](#reinstall-later)
|
|
26
28
|
* [Requirements](#requirements)
|
|
27
29
|
* [How it works](#how-it-works)
|
|
28
30
|
* [Troubleshooting](#troubleshooting)
|
|
@@ -41,7 +43,7 @@ During development, servers often **do not shut down properly**:
|
|
|
41
43
|
* Docker containers
|
|
42
44
|
* AI coding agents
|
|
43
45
|
|
|
44
|
-
Even after closing the terminal, the process
|
|
46
|
+
Even after closing the terminal, the process keeps running in the background and blocks ports.
|
|
45
47
|
|
|
46
48
|
Developers repeatedly run:
|
|
47
49
|
|
|
@@ -50,11 +52,11 @@ lsof -i :3000
|
|
|
50
52
|
kill -9 <PID>
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
`portcleaner` automates this entire process.
|
|
54
56
|
|
|
55
57
|
---
|
|
56
58
|
|
|
57
|
-
##
|
|
59
|
+
## Features
|
|
58
60
|
|
|
59
61
|
* Detects active listening ports
|
|
60
62
|
* Finds development servers automatically
|
|
@@ -65,165 +67,155 @@ This tool automates that entire process.
|
|
|
65
67
|
|
|
66
68
|
---
|
|
67
69
|
|
|
68
|
-
##
|
|
70
|
+
## Supported Platforms
|
|
71
|
+
|
|
72
|
+
| OS | Support |
|
|
73
|
+
| ---------------------------------- | ------------ |
|
|
74
|
+
| macOS | Full support |
|
|
75
|
+
| Linux (Ubuntu, Debian, Arch, etc.) | Full support |
|
|
76
|
+
| Windows (WSL) | Supported |
|
|
77
|
+
| Windows PowerShell / CMD | Limited |
|
|
69
78
|
|
|
70
|
-
|
|
71
|
-
| ---------------------------------- | -------------- |
|
|
72
|
-
| macOS | β
Full support |
|
|
73
|
-
| Linux (Ubuntu, Debian, Arch, etc.) | β
Full support |
|
|
74
|
-
| Windows (WSL) | β
Supported |
|
|
75
|
-
| Windows (PowerShell / CMD native) | β οΈ Limited |
|
|
79
|
+
### Windows users
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
Windows does not include the `lsof` utility by default.
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
Please run this tool inside:
|
|
83
|
+
Please run the tool inside:
|
|
81
84
|
|
|
82
85
|
* WSL (recommended)
|
|
83
86
|
* Git Bash
|
|
84
87
|
|
|
85
88
|
---
|
|
86
89
|
|
|
87
|
-
##
|
|
90
|
+
## Quick Install (Recommended)
|
|
88
91
|
|
|
89
|
-
|
|
92
|
+
Install globally from npm:
|
|
90
93
|
|
|
91
94
|
```
|
|
92
|
-
npm install -g
|
|
95
|
+
npm install -g portcleaner
|
|
93
96
|
```
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
Then run:
|
|
96
99
|
|
|
97
100
|
```
|
|
98
|
-
|
|
101
|
+
portcleaner
|
|
99
102
|
```
|
|
100
103
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
The installer automatically:
|
|
104
|
-
|
|
105
|
-
* registers the CLI command
|
|
106
|
-
* grants permissions
|
|
107
|
-
* verifies environment
|
|
104
|
+
No configuration needed.
|
|
108
105
|
|
|
109
106
|
---
|
|
110
107
|
|
|
111
|
-
##
|
|
108
|
+
## Manual Installation (For Contributors)
|
|
112
109
|
|
|
113
|
-
|
|
110
|
+
If you cloned the repository:
|
|
114
111
|
|
|
115
112
|
```
|
|
116
|
-
git clone https://github.com/<your-username>/
|
|
117
|
-
cd
|
|
113
|
+
git clone https://github.com/<your-username>/port_cleaner.git
|
|
114
|
+
cd port_cleaner
|
|
118
115
|
npm install
|
|
119
116
|
npm link
|
|
120
117
|
```
|
|
121
118
|
|
|
122
|
-
Now
|
|
119
|
+
Now you can run:
|
|
123
120
|
|
|
124
121
|
```
|
|
125
|
-
|
|
122
|
+
portcleaner
|
|
126
123
|
```
|
|
127
124
|
|
|
128
125
|
---
|
|
129
126
|
|
|
130
|
-
##
|
|
131
|
-
|
|
132
|
-
Run:
|
|
127
|
+
## Usage
|
|
133
128
|
|
|
134
129
|
```
|
|
135
|
-
|
|
130
|
+
portcleaner
|
|
136
131
|
```
|
|
137
132
|
|
|
138
|
-
Example
|
|
133
|
+
Example:
|
|
139
134
|
|
|
140
135
|
```
|
|
141
|
-
|
|
136
|
+
Scanning for running dev servers...
|
|
142
137
|
|
|
143
|
-
|
|
138
|
+
Found running servers:
|
|
139
|
+
β’ node on port 3000
|
|
140
|
+
β’ docker-proxy on port 5432
|
|
144
141
|
|
|
145
|
-
|
|
146
|
-
β’ docker-proxy running on port 5432 (PID 8821)
|
|
142
|
+
Cleaning ports...
|
|
147
143
|
|
|
148
|
-
|
|
144
|
+
Killed node on port 3000
|
|
145
|
+
Killed docker-proxy on port 5432
|
|
149
146
|
|
|
150
|
-
|
|
151
|
-
β Killed docker-proxy on port 5432
|
|
152
|
-
|
|
153
|
-
π All development ports cleaned!
|
|
147
|
+
All development ports cleaned!
|
|
154
148
|
```
|
|
155
149
|
|
|
156
150
|
---
|
|
157
151
|
|
|
158
|
-
##
|
|
152
|
+
## Use inside your project
|
|
159
153
|
|
|
160
|
-
|
|
154
|
+
Automatically clean ports before starting your app.
|
|
161
155
|
|
|
162
|
-
Add
|
|
156
|
+
Add to `package.json`:
|
|
163
157
|
|
|
164
158
|
```
|
|
165
159
|
"scripts": {
|
|
166
|
-
"dev": "
|
|
160
|
+
"dev": "portcleaner && next dev"
|
|
167
161
|
}
|
|
168
162
|
```
|
|
169
163
|
|
|
170
|
-
or
|
|
164
|
+
or:
|
|
171
165
|
|
|
172
166
|
```
|
|
173
|
-
"
|
|
167
|
+
"scripts": {
|
|
168
|
+
"dev": "portcleaner && nodemon src/index.js"
|
|
169
|
+
}
|
|
174
170
|
```
|
|
175
171
|
|
|
176
|
-
Now every time
|
|
172
|
+
Now every time the project starts β ports are freed first.
|
|
177
173
|
|
|
178
174
|
---
|
|
179
175
|
|
|
180
|
-
##
|
|
176
|
+
## Uninstall / Disable
|
|
181
177
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
### If installed globally (recommended install)
|
|
178
|
+
To remove the command from your system:
|
|
185
179
|
|
|
186
180
|
```
|
|
187
|
-
npm uninstall -g
|
|
181
|
+
npm uninstall -g portcleaner
|
|
188
182
|
```
|
|
189
183
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
Inside the project folder:
|
|
184
|
+
If installed via `npm link`:
|
|
193
185
|
|
|
194
186
|
```
|
|
195
|
-
npm unlink -g
|
|
187
|
+
npm unlink -g portcleaner
|
|
196
188
|
```
|
|
197
189
|
|
|
198
|
-
After uninstalling
|
|
190
|
+
After uninstalling:
|
|
199
191
|
|
|
200
192
|
```
|
|
201
|
-
|
|
193
|
+
portcleaner
|
|
202
194
|
```
|
|
203
195
|
|
|
204
196
|
will no longer work.
|
|
205
197
|
|
|
206
198
|
---
|
|
207
199
|
|
|
208
|
-
##
|
|
200
|
+
## Reinstall later
|
|
209
201
|
|
|
210
|
-
You can
|
|
202
|
+
You can enable it again anytime:
|
|
211
203
|
|
|
212
204
|
```
|
|
213
|
-
npm install -g
|
|
205
|
+
npm install -g portcleaner
|
|
214
206
|
```
|
|
215
207
|
|
|
216
208
|
The command will immediately start working again.
|
|
217
209
|
|
|
218
210
|
---
|
|
219
211
|
|
|
220
|
-
##
|
|
212
|
+
## Requirements
|
|
221
213
|
|
|
222
|
-
* Node.js
|
|
223
|
-
* macOS or Linux (native
|
|
214
|
+
* Node.js 16 or newer
|
|
215
|
+
* macOS or Linux (native)
|
|
224
216
|
* Windows requires WSL or Git Bash
|
|
225
217
|
|
|
226
|
-
Check
|
|
218
|
+
Check:
|
|
227
219
|
|
|
228
220
|
```
|
|
229
221
|
node -v
|
|
@@ -231,15 +223,15 @@ node -v
|
|
|
231
223
|
|
|
232
224
|
---
|
|
233
225
|
|
|
234
|
-
##
|
|
226
|
+
## How it works
|
|
235
227
|
|
|
236
|
-
|
|
228
|
+
Internally the CLI runs:
|
|
237
229
|
|
|
238
230
|
```
|
|
239
231
|
lsof -i -P -n | grep LISTEN
|
|
240
232
|
```
|
|
241
233
|
|
|
242
|
-
It filters
|
|
234
|
+
It filters development processes such as:
|
|
243
235
|
|
|
244
236
|
* node
|
|
245
237
|
* bun
|
|
@@ -248,59 +240,60 @@ It filters only known development processes:
|
|
|
248
240
|
* docker
|
|
249
241
|
* docker-proxy
|
|
250
242
|
|
|
251
|
-
Then safely terminates them
|
|
243
|
+
Then safely terminates them.
|
|
252
244
|
|
|
253
245
|
---
|
|
254
246
|
|
|
255
|
-
##
|
|
247
|
+
## Troubleshooting
|
|
256
248
|
|
|
257
|
-
### `
|
|
249
|
+
### `portcleaner: command not found`
|
|
258
250
|
|
|
259
|
-
Restart terminal or
|
|
251
|
+
Restart terminal or reopen shell.
|
|
260
252
|
|
|
261
|
-
|
|
262
|
-
source ~/.zshrc
|
|
263
|
-
```
|
|
253
|
+
### Nothing was cleaned
|
|
264
254
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
### Permission denied
|
|
255
|
+
Check if a port is actually in use:
|
|
268
256
|
|
|
269
257
|
```
|
|
270
|
-
|
|
258
|
+
lsof -i :3000
|
|
271
259
|
```
|
|
272
260
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
### Nothing was killed
|
|
261
|
+
### Windows not working
|
|
276
262
|
|
|
277
|
-
|
|
263
|
+
Use WSL:
|
|
278
264
|
|
|
279
265
|
```
|
|
280
|
-
|
|
266
|
+
wsl
|
|
267
|
+
npm install -g portcleaner
|
|
268
|
+
portcleaner
|
|
281
269
|
```
|
|
282
270
|
|
|
283
271
|
---
|
|
284
272
|
|
|
285
|
-
##
|
|
273
|
+
## Contributing
|
|
286
274
|
|
|
287
275
|
Pull requests are welcome.
|
|
288
276
|
|
|
289
|
-
|
|
277
|
+
Ideas:
|
|
290
278
|
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
279
|
+
* port specific cleaning (`portcleaner 3000`)
|
|
280
|
+
* interactive mode
|
|
281
|
+
* skip database ports (5432, 27017)
|
|
282
|
+
* native Windows support
|
|
295
283
|
|
|
296
284
|
---
|
|
297
285
|
|
|
298
|
-
##
|
|
286
|
+
## License
|
|
299
287
|
|
|
300
|
-
MIT
|
|
288
|
+
[MIT](LICENSE)
|
|
301
289
|
|
|
302
290
|
---
|
|
303
291
|
|
|
304
|
-
##
|
|
292
|
+
## Author
|
|
293
|
+
|
|
294
|
+
Created and maintained by [Shubhashish Chakraborty](https://imshubh.site) <br/>
|
|
295
|
+
For any queries, reach out via email at shubhashish147@gmail.com. <br/>
|
|
305
296
|
|
|
306
|
-
|
|
297
|
+
[](https://twitter.com/__Shubhashish__)
|
|
298
|
+
[](https://github.com/Shubhashish-Chakraborty)
|
|
299
|
+
[](https://linkedin.com/in/shubhashish-chakraborty)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "portcleaner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A CLI utility that detects and terminates stuck development servers to free ports.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"preferGlobal": true,
|
|
@@ -13,7 +13,13 @@
|
|
|
13
13
|
"engines": {
|
|
14
14
|
"node": ">=16"
|
|
15
15
|
},
|
|
16
|
-
"keywords": [
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ports",
|
|
18
|
+
"kill-port",
|
|
19
|
+
"dev-tools",
|
|
20
|
+
"node",
|
|
21
|
+
"cli"
|
|
22
|
+
],
|
|
17
23
|
"author": "Shubhashish Chakraborty",
|
|
18
24
|
"license": "MIT",
|
|
19
25
|
"type": "commonjs"
|