From 65a59f01f5e663e70b9b7c75aba91714a344f4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Tue, 16 Apr 2024 02:40:35 +0200 Subject: [PATCH 1/3] update for Fastify v5 --- .github/workflows/ci.yml | 2 +- .taprc | 6 ++---- package.json | 10 +++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b00276..5395d92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ on: jobs: test: - uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3 + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v4.1.0 with: license-check: true lint: true diff --git a/.taprc b/.taprc index 2188e32..4452414 100644 --- a/.taprc +++ b/.taprc @@ -1,4 +1,2 @@ -ts: false -jsx: false -flow: false -coverage: true +files: + - test/**/*.js diff --git a/package.json b/package.json index 5dd7fea..2a4ec04 100644 --- a/package.json +++ b/package.json @@ -21,15 +21,15 @@ }, "homepage": "https://github.com/fastify/proxy-addr#readme", "dependencies": { - "@fastify/forwarded": "^2.0.0", - "ipaddr.js": "^2.0.0" + "@fastify/forwarded": "^2.2.0", + "ipaddr.js": "^2.1.0" }, "devDependencies": { - "@types/node": "^20.1.0", + "@types/node": "^20.12.7", "beautify-benchmark": "0.2.4", "benchmark": "2.1.4", - "standard": "^17.0.0", - "tap": "^16.0.0", + "standard": "^17.1.0", + "tap": "^18.7.2", "tsd": "^0.31.0" }, "scripts": { From 5587f0768706f0cc100b8f80bbf3c83731d7ef6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Tue, 16 Apr 2024 02:41:22 +0200 Subject: [PATCH 2/3] pre-commit --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index 2a4ec04..2e1e031 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "ipaddr.js": "^2.1.0" }, "devDependencies": { + "@fastify/pre-commit": "^2.1.0", "@types/node": "^20.12.7", "beautify-benchmark": "0.2.4", "benchmark": "2.1.4", @@ -35,6 +36,7 @@ "scripts": { "bench": "node benchmark/index.js", "lint": "standard", + "lint:fix": "standard --fix", "test": "npm run test:unit && npm run test:typescript", "test:typescript": "tsd", "test:unit": "tap" From a3d7f6fe4ce5f07a1c427cc521e13c70bb310b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Wed, 17 Apr 2024 15:54:46 +0200 Subject: [PATCH 3/3] use tape --- .github/workflows/ci.yml | 122 +++++++++++++++++++++++++++++++++++---- .taprc | 2 - package.json | 5 +- test/all.js | 2 +- test/base.js | 2 +- test/compile.js | 2 +- 6 files changed, 116 insertions(+), 19 deletions(-) delete mode 100644 .taprc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5395d92..441f392 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,21 +3,119 @@ name: CI on: push: branches: - - main - - master - - next - - 'v*' + - main + - master + - next + - "v*" paths-ignore: - - 'docs/**' - - '*.md' + - "docs/**" + - "*.md" pull_request: paths-ignore: - - 'docs/**' - - '*.md' + - "docs/**" + - "*.md" jobs: + dependency-review: + name: Dependency Review + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Dependency review + uses: actions/dependency-review-action@v4 + + lint: + name: Lint Code + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: Lint code + run: npm run lint + test: - uses: fastify/workflows/.github/workflows/plugins-ci.yml@v4.1.0 - with: - license-check: true - lint: true + name: Test + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + matrix: + node-version: [10, 12, 14, 16, 18, 20] + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Upgrade npm + if: ${{ success() && matrix.node-version == '6' }} + run: npm i npm@6.13.4 -g + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: Run tests + run: npm run test:unit + + typescript: + name: Test TypeScript + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Check out repo + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install dependencies + run: npm i --ignore-scripts + + - name: tsd + run: npm run test:typescript + + automerge: + name: Automerge Dependabot PRs + if: > + github.event_name == 'pull_request' && + github.event.pull_request.user.login == 'dependabot[bot]' + needs: [lint, test, typescript] + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-latest + steps: + - uses: fastify/github-action-merge-dependabot@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + target: major diff --git a/.taprc b/.taprc deleted file mode 100644 index 4452414..0000000 --- a/.taprc +++ /dev/null @@ -1,2 +0,0 @@ -files: - - test/**/*.js diff --git a/package.json b/package.json index 2e1e031..e54815c 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,9 @@ "@types/node": "^20.12.7", "beautify-benchmark": "0.2.4", "benchmark": "2.1.4", + "c8": "^7.14.0", "standard": "^17.1.0", - "tap": "^18.7.2", + "tape": "^5.7.5", "tsd": "^0.31.0" }, "scripts": { @@ -39,6 +40,6 @@ "lint:fix": "standard --fix", "test": "npm run test:unit && npm run test:typescript", "test:typescript": "tsd", - "test:unit": "tap" + "test:unit": "c8 tape test/**/*.js" } } diff --git a/test/all.js b/test/all.js index 25a3619..44da283 100644 --- a/test/all.js +++ b/test/all.js @@ -1,6 +1,6 @@ 'use strict' -const { test } = require('tap') +const test = require('tape') const proxyaddr = require('..') test('argument req should be required', function (t) { diff --git a/test/base.js b/test/base.js index f447d8a..77675e1 100644 --- a/test/base.js +++ b/test/base.js @@ -1,6 +1,6 @@ 'use strict' -const { test } = require('tap') +const test = require('tape') const proxyaddr = require('..') test('req should be required', function (t) { diff --git a/test/compile.js b/test/compile.js index a8b6c57..599a73d 100644 --- a/test/compile.js +++ b/test/compile.js @@ -1,6 +1,6 @@ 'use strict' -const { test } = require('tap') +const test = require('tape') const proxyaddr = require('..') test('trust arg should be required', function (t) {