diff --git a/.eslintrc.json b/.eslintrc.json index 9991af4..7734c8a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,5 @@ { "env": { - "es6": true, "node": true }, "extends": [ diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 16ce55c..fd117a7 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,15 +8,15 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 19.x] + node-version: [20.x] name: Node ${{ matrix.node-version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8200e60..f3bec86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,22 @@ # Changelog +## [3.0.0](https://github.com/supercharge/http-errors/compare/v2.1.0...v3.0.0) - 2024-03-xx + +### Added +- add default export allowing users to define their own import name: `import MyHttpErrorVariableName from '@supercharge/http-errors'` + +### Updated +- bump dependencies + +### Removed +- removed JS doc annotations to avoid duplications with TypeScript + +### Breaking Changes +- require Node.js v20 +- this package migrated to ESM + + ## [2.1.0](https://github.com/supercharge/http-errors/compare/v2.0.0...v2.1.0) - 2024-03-10 ### Updated diff --git a/package.json b/package.json index ca54179..7384a0b 100644 --- a/package.json +++ b/package.json @@ -10,24 +10,28 @@ "@supercharge/errors": "~2.0.1" }, "devDependencies": { - "@supercharge/eslint-config-typescript": "~2.3.2", - "@supercharge/tsconfig": "~4.0.0", - "@types/node": "~18.11.9", - "@typescript-eslint/eslint-plugin": "~5.43.0", - "c8": "~7.12.0", - "eslint": "~8.27.0", - "expect": "~29.3.1", - "typescript": "~4.8.4", + "@supercharge/eslint-config-typescript": "~4.0.2", + "@supercharge/tsconfig": "~7.0.0", + "@types/node": "~20.11.25", + "@typescript-eslint/eslint-plugin": "~7.1.1", + "c8": "~9.1.0", + "eslint": "~8.57.0", + "expect": "~29.7.0", + "typescript": "~5.4.2", "uvu": "~0.5.6" }, "engines": { - "node": ">=16" + "node": ">=20" }, - "main": "dist", - "types": "dist", "files": [ "dist" ], + "type": "module", + "main": "dist/index.js", + "types": "dist", + "exports": { + ".": "./dist/index.js" + }, "homepage": "https://github.com/supercharge/http-errors", "keywords": [ "supercharge", diff --git a/src/http-error.ts b/src/http-error.ts index 875382c..d5af3a7 100644 --- a/src/http-error.ts +++ b/src/http-error.ts @@ -1,4 +1,3 @@ -'use strict' import { HttpError as BaseHttpError } from '@supercharge/errors' diff --git a/src/index.ts b/src/index.ts index b00efdc..ecb2eee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ -'use strict' -import { HttpError } from './http-error' +import { HttpError } from './http-error.js' export { HttpError } +export default HttpError diff --git a/test/http-error.js b/test/http-error.js index 079336f..0e6ab5c 100644 --- a/test/http-error.js +++ b/test/http-error.js @@ -1,8 +1,8 @@ 'use strict' -const { test } = require('uvu') -const { expect } = require('expect') -const { HttpError } = require('../dist') +import { test } from 'uvu' +import { expect } from 'expect' +import { HttpError } from '../dist/index.js' test('isHttpError', () => { expect(HttpError.isHttpError(HttpError.badRequest('message'))).toBe(true)