From 48dfe47d63f137b05f6a540ccfc0f0fa133a847a Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Wed, 8 May 2024 23:31:51 +0800 Subject: [PATCH] Revert "feat: use address@2 (#53)" (#54) This reverts commit 55f48d755f3c8b480d4e4ce1065abc1c8e3c5a19. --- .eslintrc.js | 2 + .github/workflows/codeql-analysis.yml | 74 +++++++++++++++++++++++++++ .github/workflows/nodejs.yml | 7 ++- .github/workflows/release.yml | 6 ++- README.md | 2 +- bin/detect-port.js | 2 + lib/detect-port.js | 4 +- lib/wait-port.js | 4 +- package.json | 18 ++++--- test/cli.test.js | 2 + test/detect-port.test.js | 5 +- test/wait-port.test.js | 3 ++ 12 files changed, 114 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.eslintrc.js b/.eslintrc.js index 4b63fb7..ed9eafd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,5 @@ +'use strict'; + module.exports = { extends: 'eslint-config-egg', parserOptions: { diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..0c8cb40 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,74 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '38 21 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index a3a04cb..22a8662 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -3,13 +3,16 @@ name: CI on: push: branches: [ master ] + pull_request: branches: [ master ] + workflow_dispatch: {} + jobs: Job: name: Node.js - uses: node-modules/github-actions/.github/workflows/node-test.yml@master + uses: artusjs/github-actions/.github/workflows/node-test.yml@v1 with: os: 'ubuntu-latest' - version: '14, 16, 18, 20, 22' + version: '14, 16, 18' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1c6cbb1..1612587 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,10 +4,14 @@ on: push: branches: [ master ] + workflow_dispatch: {} + jobs: release: name: Node.js - uses: node-modules/github-actions/.github/workflows/node-release.yml@master + uses: artusjs/github-actions/.github/workflows/node-release.yml@v1 secrets: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GIT_TOKEN: ${{ secrets.GIT_TOKEN }} + with: + checkTest: false diff --git a/README.md b/README.md index 1f8bf61..455d3ae 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ Most likely network error, check that your `/etc/hosts` and make sure the conten | :---: | :---: | :---: | :---: | :---: | :---: | [
snapre](https://github.com/snapre)
|[
yavuzakyuz](https://github.com/yavuzakyuz)
|[
antife-yinyue](https://github.com/antife-yinyue)
-This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Wed May 08 2024 15:54:54 GMT+0800`. +This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Wed Sep 21 2022 23:10:27 GMT+0800`. diff --git a/bin/detect-port.js b/bin/detect-port.js index 8067567..84da022 100644 --- a/bin/detect-port.js +++ b/bin/detect-port.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +'use strict'; + const pkg = require('../package'); const args = process.argv.slice(2); diff --git a/lib/detect-port.js b/lib/detect-port.js index 06c9e72..c94ceb0 100644 --- a/lib/detect-port.js +++ b/lib/detect-port.js @@ -1,6 +1,8 @@ +'use strict'; + const net = require('net'); -const debug = require('util').debuglog('detect-port'); const address = require('address'); +const debug = require('debug')('detect-port'); module.exports = (port, callback) => { let hostname = ''; diff --git a/lib/wait-port.js b/lib/wait-port.js index 2c3626b..2322aae 100644 --- a/lib/wait-port.js +++ b/lib/wait-port.js @@ -1,4 +1,6 @@ -const debug = require('util').debuglog('wait-port'); +'use strict'; + +const debug = require('debug')('wait-port'); const detect = require('./detect-port'); const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); diff --git a/package.json b/package.json index 3243d12..0d33a2d 100644 --- a/package.json +++ b/package.json @@ -21,16 +21,18 @@ "url": "git://github.com/node-modules/detect-port.git" }, "dependencies": { - "address": "^2.0.2" + "address": "^1.0.1", + "debug": "4" }, "devDependencies": { "command-line-test": "1", - "egg-bin": "6", - "eslint": "8", - "eslint-config-egg": "12", - "git-contributor": "2", - "mm": "3", - "pedding": "1" + "egg-bin": "^5.2.0", + "eslint": "^8.23.1", + "eslint-config-egg": "^12.0.0", + "git-contributor": "1", + "mm": "^2.1.0", + "pedding": "^1.1.0", + "power-assert": "^1.6.1" }, "scripts": { "test": "egg-bin test", @@ -39,7 +41,7 @@ "contributor": "git-contributor" }, "engines": { - "node": ">= 14.0.0" + "node": ">= 4.0.0" }, "homepage": "https://github.com/node-modules/detect-port", "license": "MIT" diff --git a/test/cli.test.js b/test/cli.test.js index d7e3d56..a5067ab 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -1,3 +1,5 @@ +'use strict'; + const path = require('path'); const assert = require('assert'); const CliTest = require('command-line-test'); diff --git a/test/detect-port.test.js b/test/detect-port.test.js index 8c4d1d4..af1b3a5 100644 --- a/test/detect-port.test.js +++ b/test/detect-port.test.js @@ -1,9 +1,12 @@ +'use strict'; + const mm = require('mm'); const dns = require('dns'); const net = require('net'); const pedding = require('pedding'); const address = require('address'); -const assert = require('assert'); +const assert = require('power-assert'); + const detectPort = require('..'); describe('test/detect-port.test.js', () => { diff --git a/test/wait-port.test.js b/test/wait-port.test.js index ac573ea..84f407a 100644 --- a/test/wait-port.test.js +++ b/test/wait-port.test.js @@ -1,5 +1,8 @@ +'use strict'; + const mm = require('mm'); const net = require('net'); + const { waitPort } = require('..'); describe('test/wait-port.test.js', () => {