Skip to content

Commit

Permalink
feat: remove semver and depd (#113)
Browse files Browse the repository at this point in the history
https://security.snyk.io/package/npm/semver

eggjs/egg-bin#270


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a new script to manage contributors automatically in the
project.

- **Documentation**
- Updated README to include a list of contributors with their GitHub
profiles and avatars.

- **Refactor**
- Replaced deprecated message logging with `console.warn` for HTTPS
configuration.
- Removed `semver` dependency and simplified related logic in the
project.

- **Chores**
- Updated Node.js CI workflow to include an additional Node.js version
and added `CODECOV_TOKEN` secret.
- Updated `semver` version in `package.json` and added `git-contributor`
dependency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 authored Jun 3, 2024
1 parent 72f7b33 commit 789a1cd
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 85 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/codeql.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CI
on:
push:
branches: [ master ]

pull_request:
branches: [ master ]

Expand All @@ -13,4 +12,6 @@ jobs:
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest'
version: '14, 16, 18, 20'
version: '14, 16, 18, 20, 22'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,17 @@ EGG_AGENT_CLOSE_TIMEOUT: agent worker boot timeout value
## License

[MIT](LICENSE)

<!-- GITCONTRIBUTOR_START -->

## Contributors

|[<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/>|
| :---: | :---: | :---: | :---: | :---: | :---: |
|[<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/>|
|[<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/>|
[<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/>

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`.

<!-- GITCONTRIBUTOR_END -->
5 changes: 3 additions & 2 deletions lib/utils/mode/impl/process/agent.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const childprocess = require('child_process');
const semver = require('semver');
const sendmessage = require('sendmessage');
const gracefulExit = require('graceful-process');

Expand Down Expand Up @@ -45,7 +44,9 @@ class AgentUtils extends BaseAgentUtils {

// add debug execArgv
const debugPort = process.env.EGG_AGENT_DEBUG_PORT || 5800;
if (this.options.isDebug) opt.execArgv = process.execArgv.concat([ `--${semver.gte(process.version, '8.0.0') ? 'inspect' : 'debug'}-port=${debugPort}` ]);
if (this.options.isDebug) {
opt.execArgv = process.execArgv.concat([ `--inspect-port=${debugPort}` ]);
}

const worker = this.#worker = childprocess.fork(this.getAgentWorkerFile(), args, opt);
const agentWorker = this.instance = new AgentWorker(worker);
Expand Down
5 changes: 2 additions & 3 deletions lib/utils/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const path = require('path');
const assert = require('assert');
const utils = require('egg-utils');
const is = require('is-type-of');
const deprecate = require('depd')('egg');

module.exports = function(options) {
const defaults = {
Expand Down Expand Up @@ -46,7 +45,7 @@ module.exports = function(options) {
if (is.boolean(options.https)) {
// TODO: compatible options.key, options.cert, will remove at next major
/* istanbul ignore next */
deprecate('[master] Please use `https: { key, cert, ca }` instead of `https: true`');
console.warn('[egg-cluster:deprecated] [master] Please use `https: { key, cert, ca }` instead of `https: true`');
options.https = {
key: options.key,
cert: options.cert,
Expand All @@ -61,7 +60,7 @@ module.exports = function(options) {
options.workers = parseInt(options.workers, 10);
if (options.require) options.require = [].concat(options.require);

// don't print depd message in production env.
// don't print deprecated message in production env.
// it will print to stderr.
if (process.env.NODE_ENV === 'production') {
process.env.NO_DEPRECATION = '*';
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"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"
"ci": "npm run lint && npm run cov",
"contributor": "git-contributor"
},
"files": [
"index.js",
Expand All @@ -33,15 +34,13 @@
"await-event": "^2.1.0",
"cfork": "^1.7.1",
"cluster-reload": "^1.0.2",
"depd": "^2.0.0",
"detect-port": "^1.3.0",
"egg-logger": "^3.3.0",
"egg-utils": "^2.4.1",
"get-ready": "^2.0.1",
"graceful-process": "^1.2.0",
"is-type-of": "^1.2.1",
"ps-tree": "^1.2.0",
"semver": "^5.6.0",
"sendmessage": "^1.1.0",
"terminal-link": "^2.1.1",
"utility": "^1.15.0"
Expand All @@ -55,6 +54,7 @@
"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
6 changes: 2 additions & 4 deletions test/master.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const cp = require('child_process');
const pedding = require('pedding');
const mm = require('egg-mock');
const request = require('supertest');
const semver = require('semver');
const awaitEvent = require('await-event');
const utils = require('./utils');
const { sleep } = require('../lib/utils/timer');
Expand Down Expand Up @@ -688,9 +687,8 @@ describe('test/master.test.js', () => {
let app;
afterEach(() => app.close());

// 6.x: Debugger listening on [::]:5858
// 8.x: Debugger listening on ws://127.0.0.1:9229/221caad4-e2d0-4630-b0bb-f7fb27b81ff6
const debugProtocol = semver.gte(process.version, '8.0.0') ? 'inspect' : 'debug';
// Debugger listening on ws://127.0.0.1:9229/221caad4-e2d0-4630-b0bb-f7fb27b81ff6
const debugProtocol = 'inspect';

it('should debug', () => {
app = utils.cluster('apps/debug-port', { workers: 2, opt: { execArgv: [ `--${debugProtocol}` ] } });
Expand Down

0 comments on commit 789a1cd

Please sign in to comment.