Skip to content

Commit

Permalink
feat: support fastify 5 (#346)
Browse files Browse the repository at this point in the history
Add support for fastify 5 and remove old
Node.js versions in ci tests.
  • Loading branch information
dnlup authored Nov 29, 2024
1 parent 6bf2574 commit 0bffa37
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 42 deletions.
12 changes: 0 additions & 12 deletions .github/FUNDING.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [14.x, 16.x]
node-version: [20.x, 22.x]

runs-on: ${{ matrix.os }}

Expand All @@ -37,5 +37,8 @@ jobs:
- name: Run tests
run: npm run test:ci

- name: Run tests on fastify 4
run: npm i fastify@4 && npm run test:ci

- name: Coverage report
uses: codecov/[email protected]
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
$ npm i @dnlup/fastify-traps
```

If you are using fastify 3, use the version `1` of the plugin:

```bash
$ npm i @dnlup/fastify-traps@1
```

## Usage

#### Default
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ function plugin (fastify, opts, next) {
}

module.exports = fp(plugin, {
fastify: '^4.0.0',
fastify: '>=4.0.0',
name: '@dnlup/fastify-traps'
})
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
},
"homepage": "https://github.com/dnlup/fastify-traps#readme",
"devDependencies": {
"@types/node": "^20.1.2",
"fastify": "^4.1.0",
"@types/node": "^22.10.1",
"fastify": "^5.1.0",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"markdown-toc": "^1.2.0",
Expand All @@ -59,6 +59,6 @@
"typescript": "^5.0.4"
},
"dependencies": {
"fastify-plugin": "^4.0.0"
"fastify-plugin": "^5.0.1"
}
}
5 changes: 1 addition & 4 deletions test/fixtures/close.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ const fastify = Fastify(fastifyOptions)

fastify.register(plugin, { strict: false })

fastify.listen(0, (err) => {
const payload = err ? 'error' : 'listening'
send(payload)
})
fastify.listen({ port: 0 }).then(() => send('listening')).catch(e => send('error'))
4 changes: 1 addition & 3 deletions test/fixtures/closeError.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ fastify.register(plugin, {
strict: false
})

fastify.listen(0, err => {
send(err ? 'error' : 'listening')
})
fastify.listen({ port: 0 }).then(() => send('listening')).catch(e => send('error'))
4 changes: 1 addition & 3 deletions test/fixtures/closeTimeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ fastify.register(plugin, {
strict: false
})

fastify.listen(0, err => {
send(err ? 'error' : 'listening')
})
fastify.listen({ port: 0 }).then(() => send('listening')).catch(e => send('error'))
4 changes: 1 addition & 3 deletions test/fixtures/customCloseHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ fastify.register(plugin, {
strict: false
})

fastify.listen(0, err => {
send(err ? 'error' : 'listening')
})
fastify.listen({ port: 0 }).then(() => send('listening')).catch(e => send('error'))
4 changes: 1 addition & 3 deletions test/fixtures/customErrorHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ fastify.register(plugin, {
strict: false
})

fastify.listen(0, err => {
send(err ? 'error' : 'listening')
})
fastify.listen({ port: 0 }).then(() => send('listening')).catch(e => send('error'))
4 changes: 1 addition & 3 deletions test/fixtures/customTimeoutHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ fastify.register(plugin, {
strict: false
})

fastify.listen(0, err => {
send(err ? 'error' : 'listening')
})
fastify.listen({ port: 0 }).then(() => send('listening')).catch(e => send('error'))

0 comments on commit 0bffa37

Please sign in to comment.