From 6aa8da36461f0ad6de29a5d7e5f4ccd89ffd1746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20P=C3=B6hls?= Date: Sun, 10 Mar 2024 05:45:22 +0100 Subject: [PATCH 1/5] wip --- .eslintrc.json | 1 - CHANGELOG.md | 13 +++++++++++++ package.json | 26 +++++++++++++++----------- src/http-error.ts | 1 - src/index.ts | 3 +-- test/http-error.js | 6 +++--- 6 files changed, 32 insertions(+), 18 deletions(-) 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/CHANGELOG.md b/CHANGELOG.md index aaa65c9..96f1dcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,19 @@ # Changelog +## [3.0.0](https://github.com/supercharge/http-errors/compare/v2.0.0...v3.0.0) - 2023-12-xx + +### 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.0.0](https://github.com/supercharge/http-errors/compare/v1.1.0...v2.0.0) - 2022-11-17 ### Updated diff --git a/package.json b/package.json index 95a93f2..3e0e4b8 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.1", + "@supercharge/tsconfig": "~7.0.0", + "@types/node": "~20.10.5", + "@typescript-eslint/eslint-plugin": "~6.16.0", + "c8": "~8.0.1", + "eslint": "~8.56.0", + "expect": "~29.7.0", + "typescript": "~5.3.3", "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 5c247df..bb67288 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..006bd46 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,4 @@ -'use strict' -import { HttpError } from './http-error' +import { HttpError } from './http-error.js' export { HttpError } diff --git a/test/http-error.js b/test/http-error.js index 3659cdf..9cb2d35 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) From d1c058a58132d6841d87e7abeae544d20088f309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20P=C3=B6hls?= Date: Sun, 10 Mar 2024 05:55:00 +0100 Subject: [PATCH 2/5] add default export --- CHANGELOG.md | 3 +++ src/index.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dec78cb..f3bec86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## [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 diff --git a/src/index.ts b/src/index.ts index 006bd46..ecb2eee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,3 +2,4 @@ import { HttpError } from './http-error.js' export { HttpError } +export default HttpError From 9d0817638db7cfee8c9aeb1cda26d17dc339848b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20P=C3=B6hls?= Date: Sun, 10 Mar 2024 05:55:54 +0100 Subject: [PATCH 3/5] test on node 20 only --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 16ce55c..f04fdd4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 19.x] + node-version: [20.x] name: Node ${{ matrix.node-version }} From 14b7cffee23c8b68e10eae51403249c44d3b3581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20P=C3=B6hls?= Date: Sun, 10 Mar 2024 05:56:08 +0100 Subject: [PATCH 4/5] bump dependencies of GitHub Action --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index f04fdd4..fd117a7 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,10 +13,10 @@ jobs: 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 }} From 267dfe131b88da9bd21d57db0c37ba1545f44afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20P=C3=B6hls?= Date: Sun, 10 Mar 2024 06:06:19 +0100 Subject: [PATCH 5/5] bump deps --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index b32e5de..7384a0b 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,14 @@ "@supercharge/errors": "~2.0.1" }, "devDependencies": { - "@supercharge/eslint-config-typescript": "~4.0.1", + "@supercharge/eslint-config-typescript": "~4.0.2", "@supercharge/tsconfig": "~7.0.0", - "@types/node": "~20.10.5", - "@typescript-eslint/eslint-plugin": "~6.16.0", - "c8": "~8.0.1", - "eslint": "~8.56.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.3.3", + "typescript": "~5.4.2", "uvu": "~0.5.6" }, "engines": {