Skip to content

Commit

Permalink
feat: upgrade Bugsnag to v8 (#123)
Browse files Browse the repository at this point in the history
* feat: tsup and bugsnag upgrade

Signed-off-by: Žiga Strgar <ziga.strgar@gmail.com>

* docs: Update readme

Signed-off-by: Žiga Strgar <ziga.strgar@gmail.com>

* fix: dist ignore

Signed-off-by: Žiga Strgar <ziga.strgar@gmail.com>
(cherry picked from commit fb9775c)

---------

Signed-off-by: Žiga Strgar <ziga.strgar@gmail.com>
  • Loading branch information
ZigaStrgar committed Sep 24, 2024
1 parent 747067c commit 12baa1d
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 61 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ the request data to the error. That includes `body`, `query` and `params` which
| | Version |
|---------|--------------------------------------------------------------------|
| Fastify | `^4.x` |
| Bugsnag | `^7.17.0` |
| Bugsnag | `^8.0.0` |
| Node | <code>^18.12.1 &#124;&#124; ^20.10.0 &#124;&#124; >= 21.0.0</code> |

## Installation
Expand Down
12 changes: 0 additions & 12 deletions fix-package-json.sh

This file was deleted.

32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@
"name": "fastify-bugsnag",
"version": "4.0.0",
"description": "Fastify plugin for Bugsnag",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/cjs/index.d.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"scripts": {
"prebuild": "rimraf dist",
"build": "npm run build:cjs && npm run build:esm",
"postbuild": "./fix-package-json.sh",
"build:cjs": "tsc -p ./tsconfig.build.cjs.json",
"build:esm": "tsc -p ./tsconfig.build.esm.json",
"build": "tsup-node",
"lint": "ts-standard --verbose | snazzy",
"lint:fix": "ts-standard --fix | snazzy",
"prepublish": "npm run build",
"prepublishOnly": "npm run build",
"postversion": "git push --tags && git push origin main && echo \"Successfully published new package version $npm_package_version\"",
"preversion": "npm run lint && npm run test && npm run test:d && npm run build",
"test": "nyc --reporter=lcov ts-mocha",
Expand Down Expand Up @@ -50,8 +46,8 @@
},
"homepage": "https://github.com/ZigaStrgar/fastify-bugsnag#readme",
"dependencies": {
"@bugsnag/js": "^7.20.2",
"@bugsnag/node": "^7.17.0",
"@bugsnag/js": "^8.0.0",
"@bugsnag/node": "^8.0.0",
"fastify-plugin": "^4.0.0"
},
"engines": {
Expand All @@ -72,15 +68,17 @@
"ts-node": "^10.8.0",
"ts-standard": "^12.0.0",
"tsd": "^0.30.3",
"typescript": "~5.1.6"
"tsup": "^8.3.0",
"typescript": "~5.6"
},
"ts-standard": {
"ignore": [
"dist"
],
"files": [
"src/**/*.ts",
"test/**/*.ts"
"test/**/*.ts",
"tsup.config.ts"
]
},
"nyc": {
Expand All @@ -90,7 +88,9 @@
],
"exclude": [
"**/*.d.ts",
"test/**"
"test/**",
"tsup.config.ts",
"dist"
],
"reporter": [
"lcov"
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Bugsnag from '@bugsnag/js'
import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify'
import fp from 'fastify-plugin'

import { PluginOptions, RequestInfoWithMetadata, RequestMetadata } from './types.js'
import type { PluginOptions, RequestInfoWithMetadata, RequestMetadata } from './types.js'

function extractRequestMetadata (request: FastifyRequest): RequestMetadata {
return {
Expand Down
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Client, BrowserConfig } from '@bugsnag/js'
import { NodeConfig } from '@bugsnag/node'
import { FastifyRequest } from 'fastify'
import type { Client, BrowserConfig } from '@bugsnag/js'
import type { NodeConfig } from '@bugsnag/node'
import type { FastifyRequest } from 'fastify'

export type PluginOptions = NodeConfig | BrowserConfig

Expand Down
12 changes: 0 additions & 12 deletions tsconfig.build.cjs.json

This file was deleted.

10 changes: 0 additions & 10 deletions tsconfig.build.esm.json

This file was deleted.

18 changes: 13 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
{
"extends": "@tsconfig/node18",
"extends": "@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"moduleDetection": "force",
"isolatedModules": true,
"verbatimModuleSyntax": false,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
"module": "NodeNext",
"outDir": "dist",
"lib": ["es2022"],
"declaration": true,
"resolveJsonModule": true,
"removeComments": true,
"sourceMap": true,
"noEmit": true,
"types": [
"node"
]
"esModuleInterop": true
},
"include": [
"src/**/*.ts",
"test/**/*.ts"
"test/**/*.ts",
"tsup.config.ts"
],
"exclude": [
"node_modules"
Expand Down
8 changes: 8 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'tsup'

export default defineConfig({
entry: ['src/index.ts', 'src/types.ts'],
clean: true,
dts: true,
format: ['cjs', 'esm']
})

0 comments on commit 12baa1d

Please sign in to comment.