From b7cd24123595a281fe30df660b6ff05bbcedb66c Mon Sep 17 00:00:00 2001 From: Manuel Spigolon Date: Tue, 17 Sep 2024 21:30:25 +0200 Subject: [PATCH] major: upgrade to fastify v5 (#67) --- .github/workflows/ci.yml | 2 +- .gitignore | 1 + .npmignore | 4 +++- package.json | 8 ++++---- plugin.js | 2 +- test/example.test.mjs | 2 +- test/plugin.test.js | 2 +- test/types/types.test.ts | 2 +- 8 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b567af..de58d05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,6 @@ on: jobs: test: - uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3 + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5.0.0 with: lint: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index b80652a..0506aca 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,4 @@ dist package-lock.json .vscode +.tap \ No newline at end of file diff --git a/.npmignore b/.npmignore index a12a51c..c0da557 100644 --- a/.npmignore +++ b/.npmignore @@ -107,4 +107,6 @@ package-lock.json .vscode .github .eslintrc -test/types \ No newline at end of file +test/types +asd* +.tap diff --git a/package.json b/package.json index 487f3e6..0c483f8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "lint": "standard", "lint:fix": "standard --fix", - "test": "tap test/**.test.* && tsd", + "test": "tap --show-full-coverage && tsd", "test:types": "tsd" }, "repository": { @@ -34,13 +34,13 @@ "homepage": "https://github.com/Eomm/fastify-raw-body#readme", "devDependencies": { "@types/node": "^22.0.0", - "fastify": "^4.19.0", + "fastify": "^5.0.0", "standard": "^17.0.0", - "tap": "^16.2.0", + "tap": "^21.0.0", "tsd": "^0.31.0" }, "dependencies": { - "fastify-plugin": "^4.0.0", + "fastify-plugin": "^5.0.0", "raw-body": "^3.0.0", "secure-json-parse": "^2.4.0" }, diff --git a/plugin.js b/plugin.js index dcc2d0b..d50187f 100644 --- a/plugin.js +++ b/plugin.js @@ -104,7 +104,7 @@ function rawBody (fastify, opts, next) { } const plugin = fp(rawBody, { - fastify: '^4.19.x', + fastify: '^5.x', name: 'fastify-raw-body' }) diff --git a/test/example.test.mjs b/test/example.test.mjs index 225ddc9..33453cd 100644 --- a/test/example.test.mjs +++ b/test/example.test.mjs @@ -1,4 +1,4 @@ -import * as t from 'tap' +import t from 'tap' import Fastify from 'fastify' await t.test('register in plugins', async t => { diff --git a/test/plugin.test.js b/test/plugin.test.js index 8fee497..ae99e05 100644 --- a/test/plugin.test.js +++ b/test/plugin.test.js @@ -77,7 +77,7 @@ t.test('wrong fastify version', t => { app.ready(err => { t.ok(err) - t.match(err.message, /expected '\^4.19.x' fastify version/) + t.match(err.message, /expected '\^5.x' fastify version/) }) }) diff --git a/test/types/types.test.ts b/test/types/types.test.ts index 9691150..3768ca5 100644 --- a/test/types/types.test.ts +++ b/test/types/types.test.ts @@ -19,6 +19,6 @@ fastify.register(rawBodyPlugin, options4) fastify.register(rawBodyPlugin, options5) fastify.get('/', { config: { rawBody: true } }, (request, reply) => { - expectType(request.routeConfig.rawBody) + expectType(request.rawBody) return "rawBody enabled" })