Skip to content

Commit 8480a40

Browse files
authored
feat: use detect-port v2 (#116)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated the version of the `detect-port` package in dependencies to the latest major version. - Removed the `git-contributor` package from devDependencies. - Removed the `contributor` script from the project. - Added entries for `package-lock.json` and `.package-lock.json` to `.gitignore`. - **Documentation** - Updated the contributors section in the README.md, replacing individual avatars with a single badge linking to the contributors graph on GitHub. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent d892960 commit 8480a40

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ run
66
.tmp
77
*.log
88
.vscode
9-
.nyc_output
9+
.nyc_output
10+
package-lock.json
11+
.package-lock.json

README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,8 @@ EGG_AGENT_CLOSE_TIMEOUT: agent worker boot timeout value
7171

7272
[MIT](LICENSE)
7373

74-
<!-- GITCONTRIBUTOR_START -->
75-
7674
## Contributors
7775

78-
|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/227713?v=4" width="100px;"/><br/><sub><b>atian25</b></sub>](https://github.com/atian25)<br/>|[<img src="https://avatars.githubusercontent.com/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://avatars.githubusercontent.com/u/6897780?v=4" width="100px;"/><br/><sub><b>killagu</b></sub>](https://github.com/killagu)<br/>|[<img src="https://avatars.githubusercontent.com/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|
79-
| :---: | :---: | :---: | :---: | :---: | :---: |
80-
|[<img src="https://avatars.githubusercontent.com/u/5243774?v=4" width="100px;"/><br/><sub><b>ngot</b></sub>](https://github.com/ngot)<br/>|[<img src="https://avatars.githubusercontent.com/u/19908330?v=4" width="100px;"/><br/><sub><b>hyj1991</b></sub>](https://github.com/hyj1991)<br/>|[<img src="https://avatars.githubusercontent.com/u/5856440?v=4" width="100px;"/><br/><sub><b>whxaxes</b></sub>](https://github.com/whxaxes)<br/>|[<img src="https://avatars.githubusercontent.com/u/2170848?v=4" width="100px;"/><br/><sub><b>iyuq</b></sub>](https://github.com/iyuq)<br/>|[<img src="https://avatars.githubusercontent.com/u/2972143?v=4" width="100px;"/><br/><sub><b>nightink</b></sub>](https://github.com/nightink)<br/>|[<img src="https://avatars.githubusercontent.com/u/2160731?v=4" width="100px;"/><br/><sub><b>mansonchor</b></sub>](https://github.com/mansonchor)<br/>|
81-
|[<img src="https://avatars.githubusercontent.com/u/10825163?v=4" width="100px;"/><br/><sub><b>ImHype</b></sub>](https://github.com/ImHype)<br/>|[<img src="https://avatars.githubusercontent.com/u/1207064?v=4" width="100px;"/><br/><sub><b>gxcsoccer</b></sub>](https://github.com/gxcsoccer)<br/>|[<img src="https://avatars.githubusercontent.com/u/1763067?v=4" width="100px;"/><br/><sub><b>waitingsong</b></sub>](https://github.com/waitingsong)<br/>|[<img src="https://avatars.githubusercontent.com/u/7581901?v=4" width="100px;"/><br/><sub><b>sjfkai</b></sub>](https://github.com/sjfkai)<br/>|[<img src="https://avatars.githubusercontent.com/u/26563778?v=4" width="100px;"/><br/><sub><b>ahungrynoob</b></sub>](https://github.com/ahungrynoob)<br/>|[<img src="https://avatars.githubusercontent.com/u/3230673?v=4" width="100px;"/><br/><sub><b>qingdengyue</b></sub>](https://github.com/qingdengyue)<br/>|
82-
[<img src="https://avatars.githubusercontent.com/u/16320597?v=4" width="100px;"/><br/><sub><b>wenjiasen</b></sub>](https://github.com/wenjiasen)<br/>|[<img src="https://avatars.githubusercontent.com/u/418820?v=4" width="100px;"/><br/><sub><b>czy88840616</b></sub>](https://github.com/czy88840616)<br/>|[<img src="https://avatars.githubusercontent.com/u/9213756?v=4" width="100px;"/><br/><sub><b>gxkl</b></sub>](https://github.com/gxkl)<br/>
83-
84-
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Mon Jun 03 2024 10:59:15 GMT+0800`.
76+
[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-cluster)](https://github.com/eggjs/egg-cluster/graphs/contributors)
8577

86-
<!-- GITCONTRIBUTOR_END -->
78+
Made with [contributors-img](https://contrib.rocks).

lib/master.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const path = require('path');
77
const fs = require('fs');
88
const EventEmitter = require('events');
99
const ready = require('get-ready');
10-
const GetFreePort = require('detect-port');
10+
const { detectPort } = require('detect-port');
1111
const ConsoleLogger = require('egg-logger').EggConsoleLogger;
1212
const utility = require('utility');
1313
const terminalLink = require('terminal-link');
@@ -216,12 +216,12 @@ class Master extends EventEmitter {
216216

217217
detectPorts() {
218218
// Detect cluster client port
219-
return GetFreePort()
219+
return detectPort()
220220
.then(port => {
221221
this.options.clusterPort = port;
222222
// If sticky mode, detect worker port
223223
if (this.options.sticky) {
224-
return GetFreePort();
224+
return detectPort();
225225
}
226226
})
227227
.then(port => {

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"test": "npm run lint -- --fix && npm run test-local",
99
"test-local": "egg-bin test --ts false",
1010
"cov": "egg-bin cov --prerequire --timeout 100000 --ts false",
11-
"ci": "npm run lint && npm run cov",
12-
"contributor": "git-contributor"
11+
"ci": "npm run lint && npm run cov"
1312
},
1413
"files": [
1514
"index.js",
@@ -34,7 +33,7 @@
3433
"await-event": "^2.1.0",
3534
"cfork": "^1.7.1",
3635
"cluster-reload": "^1.0.2",
37-
"detect-port": "^1.3.0",
36+
"detect-port": "^2.0.1",
3837
"egg-logger": "^3.3.0",
3938
"egg-utils": "^2.4.1",
4039
"get-ready": "^2.0.1",
@@ -54,7 +53,6 @@
5453
"egg-mock": "^5.4.0",
5554
"eslint": "^8.26.0",
5655
"eslint-config-egg": "^12.1.0",
57-
"git-contributor": "^2.1.5",
5856
"pedding": "^1.1.0",
5957
"supertest": "^4.0.0",
6058
"ts-node": "^10.9.1",

0 commit comments

Comments
 (0)