Skip to content

Commit

Permalink
feat: support fastify@4
Browse files Browse the repository at this point in the history
BREAKING CHANGE: drops fastify 3 support
  • Loading branch information
herrmannplatz committed Dec 10, 2023
1 parent 6337d86 commit e4b8a16
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16.x
- run: npm i
- run: npm test
node-version: 20.x
- run: npm it
- run: npx semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
2 changes: 1 addition & 1 deletion LICENCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 herrmannplatz
Copyright (c) 2023 herrmannplatz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ async function fastifyDatadog (fastify, options = {}) {
})

fastify.addHook('onSend', async (req, reply) => {
const { context, statusCode } = reply
const { statusCode } = reply

const statTags = [`route:${context.config.url}`, ...tags]
const statTags = [`route:${req.routeOptions.config.url}`, ...tags]

if (method) {
statTags.push(`method:${req.method.toLowerCase()}`)
Expand All @@ -54,6 +54,6 @@ async function fastifyDatadog (fastify, options = {}) {
}

module.exports = fp(fastifyDatadog, {
fastify: '3.x',
fastify: '4.x',
name: 'fastify-datadog'
})
32 changes: 10 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"commit": "git-cz",
"test": "jest --coverage && tsd",
"posttest": "standard",
"precommit": "npm test"
"posttest": "npm run lint",
"lint": "standard",
"lint:fix": "standard --fix"
},
"keywords": [
"datadog",
Expand All @@ -19,30 +19,18 @@
"author": "herrmannplatz <[email protected]>",
"license": "MIT",
"dependencies": {
"fastify-plugin": "^1.6.1"
"fastify-plugin": "^4.5.1"
},
"devDependencies": {
"@types/node": "^14.0.14",
"commitizen": "^3.0.4",
"cz-conventional-changelog": "^2.1.0",
"fastify": "^3.0.0",
"hot-shots": "^7.7.1",
"husky": "^1.1.4",
"jest": "^26.1.0",
"semantic-release": "^15.12.0",
"standard": "^12.0.1",
"tsd": "^0.21.0"
},
"peerDependencies": {
"fastify": "^3.0.0"
"@types/node": "^20.10.4",
"fastify": "^4.24.3",
"hot-shots": "^10.0.0",
"jest": "^29.7.0",
"standard": "^17.1.0",
"tsd": "^0.29.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/herrmannplatz/fastify-datadog.git"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
}
}

0 comments on commit e4b8a16

Please sign in to comment.