killportall 1.0.2 → 1.0.4
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/LICENSE +2 -1
- package/README.md +130 -112
- package/package.json +20 -6
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
A powerful cross-platform Node.js CLI tool for efficiently killing processes on specified ports with detailed logging and interactive mode.
|
|
4
4
|
|
|
5
|
+
[](https://badge.fury.io/js/killportall)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
[](https://www.npmjs.com/package/killportall)
|
|
9
|
+
|
|
5
10
|
## Features
|
|
6
11
|
|
|
7
12
|
- 🎯 Kill processes on single or multiple ports
|
|
@@ -12,54 +17,92 @@ A powerful cross-platform Node.js CLI tool for efficiently killing processes on
|
|
|
12
17
|
- 🖥️ Cross-platform support (Windows, macOS, Linux)
|
|
13
18
|
- 🎨 JSON output format for scripting
|
|
14
19
|
- 🚀 Fast and efficient port killing
|
|
20
|
+
- 🔍 Debug mode for troubleshooting
|
|
21
|
+
- 🛡️ Robust error handling
|
|
15
22
|
|
|
16
|
-
##
|
|
23
|
+
## Quick Start
|
|
17
24
|
|
|
18
25
|
```bash
|
|
26
|
+
# Install globally
|
|
19
27
|
npm install -g killportall
|
|
20
|
-
```
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
# Kill a single port
|
|
30
|
+
killportall 3000
|
|
31
|
+
|
|
32
|
+
# Kill multiple ports
|
|
33
|
+
killportall 3000 8080 5000
|
|
23
34
|
|
|
24
|
-
|
|
35
|
+
# Interactive mode
|
|
36
|
+
killportall -i
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
25
40
|
|
|
26
|
-
|
|
41
|
+
### Global Installation (Recommended)
|
|
27
42
|
```bash
|
|
28
|
-
killportall
|
|
43
|
+
npm install -g killportall
|
|
29
44
|
```
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
### Local Installation
|
|
32
47
|
```bash
|
|
33
|
-
|
|
48
|
+
npm install killportall
|
|
34
49
|
```
|
|
35
50
|
|
|
36
|
-
|
|
51
|
+
### Development Setup
|
|
37
52
|
```bash
|
|
38
|
-
|
|
53
|
+
# Clone the repository
|
|
54
|
+
git clone https://github.com/siri1410/killportall.git
|
|
55
|
+
|
|
56
|
+
# Install dependencies
|
|
57
|
+
cd killportall
|
|
58
|
+
npm install
|
|
59
|
+
|
|
60
|
+
# Link for development
|
|
61
|
+
npm link
|
|
39
62
|
```
|
|
40
63
|
|
|
41
|
-
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
### Basic Commands
|
|
42
67
|
|
|
43
|
-
Run in interactive mode to select ports from a list:
|
|
44
68
|
```bash
|
|
69
|
+
# Kill a single port
|
|
70
|
+
killportall 3000
|
|
71
|
+
|
|
72
|
+
# Kill multiple ports
|
|
73
|
+
killportall 3000 8080 5000
|
|
74
|
+
|
|
75
|
+
# Kill a range of ports
|
|
76
|
+
killportall 3000-3005
|
|
77
|
+
|
|
78
|
+
# Interactive mode
|
|
45
79
|
killportall -i
|
|
46
|
-
|
|
47
|
-
|
|
80
|
+
|
|
81
|
+
# JSON output
|
|
82
|
+
killportall 3000 --json
|
|
83
|
+
|
|
84
|
+
# With retries
|
|
85
|
+
killportall 3000 --retries 5
|
|
86
|
+
|
|
87
|
+
# With custom timeout
|
|
88
|
+
killportall 3000 --timeout 2000
|
|
48
89
|
```
|
|
49
90
|
|
|
50
|
-
### Options
|
|
91
|
+
### Command Line Options
|
|
51
92
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
93
|
+
| Option | Description | Default |
|
|
94
|
+
|--------|-------------|---------|
|
|
95
|
+
| `-r, --retries <number>` | Number of retry attempts | 3 |
|
|
96
|
+
| `-t, --timeout <ms>` | Timeout between retries | 1000 |
|
|
97
|
+
| `-i, --interactive` | Run in interactive mode | false |
|
|
98
|
+
| `-j, --json` | Output results in JSON format | false |
|
|
99
|
+
| `--config <key=value>` | Set configuration value | - |
|
|
100
|
+
| `-v, --version` | Display version number | - |
|
|
101
|
+
| `-h, --help` | Display help information | - |
|
|
59
102
|
|
|
60
103
|
### Configuration
|
|
61
104
|
|
|
62
|
-
|
|
105
|
+
Create a `.killportallrc.json` file in your home or project directory:
|
|
63
106
|
|
|
64
107
|
```json
|
|
65
108
|
{
|
|
@@ -70,64 +113,58 @@ The tool supports configuration through a `.killportallrc.json` file in either t
|
|
|
70
113
|
}
|
|
71
114
|
```
|
|
72
115
|
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
killportall --config retries=5
|
|
76
|
-
killportall --config timeout=2000
|
|
77
|
-
killportall --config interactive=true
|
|
78
|
-
killportall --config outputFormat=json
|
|
79
|
-
```
|
|
116
|
+
### Debug Mode
|
|
80
117
|
|
|
81
|
-
|
|
118
|
+
```bash
|
|
119
|
+
# Enable debug logging
|
|
120
|
+
DEBUG=killportall:* killportall 3000
|
|
82
121
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- User (on Unix-like systems)
|
|
87
|
-
- CPU usage
|
|
88
|
-
- Memory usage
|
|
122
|
+
# Enable specific debug categories
|
|
123
|
+
DEBUG=killportall:cli,killportall:config killportall 3000
|
|
124
|
+
```
|
|
89
125
|
|
|
90
|
-
##
|
|
126
|
+
## API Usage
|
|
91
127
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
✓ Port 3000: Process killed successfully
|
|
95
|
-
✗ Port 8080: No process found
|
|
96
|
-
```
|
|
128
|
+
```javascript
|
|
129
|
+
import { killPorts } from 'killportall';
|
|
97
130
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
[
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
]
|
|
131
|
+
async function cleanupPorts() {
|
|
132
|
+
try {
|
|
133
|
+
const results = await killPorts([3000, 3001], {
|
|
134
|
+
retries: 3,
|
|
135
|
+
timeout: 1000
|
|
136
|
+
});
|
|
137
|
+
console.log('Results:', results);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error('Error:', error);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
111
142
|
```
|
|
112
143
|
|
|
113
144
|
## Error Handling
|
|
114
145
|
|
|
115
|
-
The tool
|
|
116
|
-
- Invalid port numbers
|
|
117
|
-
- Permission issues
|
|
118
|
-
- Process not found
|
|
146
|
+
The tool handles various error scenarios:
|
|
147
|
+
- Invalid port numbers (outside 1-65535 range)
|
|
148
|
+
- Permission issues (requires elevated privileges)
|
|
149
|
+
- Process not found on port
|
|
119
150
|
- Failed kill attempts
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
Enable debug logging:
|
|
124
|
-
```bash
|
|
125
|
-
DEBUG=killportall:* killportall 3000
|
|
126
|
-
```
|
|
151
|
+
- Configuration errors
|
|
152
|
+
- Network interface issues
|
|
127
153
|
|
|
128
154
|
## Contributing
|
|
129
155
|
|
|
130
|
-
|
|
156
|
+
1. Fork the repository
|
|
157
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
158
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
159
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
160
|
+
5. Open a Pull Request
|
|
161
|
+
|
|
162
|
+
### Development Guidelines
|
|
163
|
+
- Follow ESM module syntax
|
|
164
|
+
- Maintain cross-platform compatibility
|
|
165
|
+
- Add tests for new features
|
|
166
|
+
- Update documentation
|
|
167
|
+
- Follow semantic versioning
|
|
131
168
|
|
|
132
169
|
## Publication Steps
|
|
133
170
|
|
|
@@ -135,71 +172,52 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
135
172
|
|
|
136
173
|
1. Prepare for publication:
|
|
137
174
|
```bash
|
|
138
|
-
#
|
|
139
|
-
npm version patch # or minor/major for bigger changes
|
|
140
|
-
|
|
141
|
-
# Run tests
|
|
175
|
+
npm version patch # or minor/major
|
|
142
176
|
npm test
|
|
143
|
-
|
|
144
|
-
# Login to npm (if not already logged in)
|
|
145
177
|
npm login
|
|
146
178
|
```
|
|
147
179
|
|
|
148
|
-
2. Test
|
|
180
|
+
2. Test locally:
|
|
149
181
|
```bash
|
|
150
|
-
# Link package locally
|
|
151
182
|
npm link
|
|
152
|
-
|
|
153
|
-
# Test CLI
|
|
154
183
|
killportall --version
|
|
155
|
-
killportall --help
|
|
156
|
-
|
|
157
|
-
# Run some test commands
|
|
158
|
-
killportall 3000
|
|
159
|
-
killportall -i
|
|
160
184
|
```
|
|
161
185
|
|
|
162
|
-
3. Publish
|
|
186
|
+
3. Publish:
|
|
163
187
|
```bash
|
|
164
|
-
|
|
165
|
-
npm
|
|
188
|
+
npm run clean
|
|
189
|
+
npm run link
|
|
166
190
|
|
|
167
|
-
|
|
191
|
+
npm run reset
|
|
192
|
+
npm run setup
|
|
193
|
+
|
|
194
|
+
npm publish
|
|
195
|
+
# or for beta
|
|
168
196
|
npm publish --tag beta
|
|
169
197
|
```
|
|
170
198
|
|
|
171
|
-
4. Create
|
|
199
|
+
4. Create release:
|
|
172
200
|
```bash
|
|
173
|
-
|
|
174
|
-
git
|
|
175
|
-
git push origin v1.0.0
|
|
176
|
-
|
|
177
|
-
# Create release on GitHub with release notes
|
|
201
|
+
git tag v1.0.3
|
|
202
|
+
git push origin v1.0.3
|
|
178
203
|
```
|
|
179
204
|
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
# Unlink local version
|
|
183
|
-
npm unlink killportall
|
|
205
|
+
## Version Guidelines
|
|
184
206
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
# Verify installation
|
|
189
|
-
killportall --version
|
|
190
|
-
```
|
|
207
|
+
- MAJOR (1.x.x): Breaking changes
|
|
208
|
+
- MINOR (x.1.x): New features (backward compatible)
|
|
209
|
+
- PATCH (x.x.1): Bug fixes (backward compatible)
|
|
191
210
|
|
|
192
|
-
|
|
211
|
+
## License
|
|
193
212
|
|
|
194
|
-
|
|
195
|
-
- MINOR version (x.1.x): New features, backward compatible
|
|
196
|
-
- PATCH version (x.x.1): Bug fixes, backward compatible
|
|
213
|
+
MIT © [Sireesh Yarlagadda](https://github.com/siri1410)
|
|
197
214
|
|
|
198
|
-
##
|
|
215
|
+
## Support
|
|
199
216
|
|
|
200
|
-
|
|
217
|
+
- GitHub Issues: [Report Bug](https://github.com/siri1410/killportall/issues)
|
|
218
|
+
- Email: contact@yarlis.com
|
|
201
219
|
|
|
202
|
-
##
|
|
220
|
+
## Acknowledgments
|
|
203
221
|
|
|
204
|
-
|
|
205
|
-
|
|
222
|
+
- Cross-platform support inspired by Node.js community
|
|
223
|
+
- CLI design influenced by popular tools like npm and yarn
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "killportall",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A cross-platform Node.js CLI tool for efficiently killing processes on specified ports",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/killportall.js",
|
|
@@ -22,11 +22,26 @@
|
|
|
22
22
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --no-cache",
|
|
23
23
|
"start": "node bin/killportall.js",
|
|
24
24
|
"prepublishOnly": "npm test",
|
|
25
|
-
"postinstall": "chmod +x bin/killportall.js"
|
|
25
|
+
"postinstall": "chmod +x bin/killportall.js",
|
|
26
|
+
"preinstall": "node -e \"if(process.env.npm_config_global) { process.exit(0) }\"",
|
|
27
|
+
"setup": "chmod +x bin/killportall.js && npm link --force",
|
|
28
|
+
"clean": "npm unlink -g killportall || true",
|
|
29
|
+
"reset": "npm run clean && npm run setup",
|
|
30
|
+
"link": "npm link --force"
|
|
26
31
|
},
|
|
27
|
-
"keywords": [
|
|
32
|
+
"keywords": [
|
|
33
|
+
"port",
|
|
34
|
+
"kill",
|
|
35
|
+
"process",
|
|
36
|
+
"cli",
|
|
37
|
+
"allportkill",
|
|
38
|
+
"killportall",
|
|
39
|
+
"portkill",
|
|
40
|
+
"portkillall",
|
|
41
|
+
"cross-platform"
|
|
42
|
+
],
|
|
28
43
|
"author": "contact@yarlis.com>",
|
|
29
|
-
"license": "
|
|
44
|
+
"license": "MIT",
|
|
30
45
|
"bugs": {
|
|
31
46
|
"url": "https://github.com/siri1410/killportall/issues"
|
|
32
47
|
},
|
|
@@ -37,7 +52,6 @@
|
|
|
37
52
|
"cross-spawn": "^7.0.3",
|
|
38
53
|
"debug": "^4.3.7",
|
|
39
54
|
"inquirer": "^12.0.1",
|
|
40
|
-
"jest": "^29.7.0"
|
|
41
|
-
"killportall": "^1.0.1"
|
|
55
|
+
"jest": "^29.7.0"
|
|
42
56
|
}
|
|
43
57
|
}
|