diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 58fe5d6..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - root: true, - env: { - browser: true, - node: true - }, - extends: [ - 'digitalbazaar', - 'digitalbazaar/jsdoc', - 'digitalbazaar/module' - ], - ignorePatterns: ['dist/'], - rules: { - 'unicorn/prefer-node-protocol': 'error' - } -}; diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..9a0596c --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,90 @@ +name: Main CI + +on: [push] + +permissions: {} + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + matrix: + node-version: [24.x] + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v6 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - name: Run eslint + run: npm run lint + test-node: + runs-on: ubuntu-latest + needs: [lint] + timeout-minutes: 10 + strategy: + matrix: + node-version: [18.x, 20.x, 22.x, 24.x] + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Install with Node.js 24.x + uses: actions/setup-node@v6 + with: + node-version: 24.x + - run: npm install + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v6 + with: + node-version: ${{ matrix.node-version }} + - name: Run ESM test with Node.js ${{ matrix.node-version }} + run: npm run test-node + - name: Run CJS test with Node.js ${{ matrix.node-version }} + run: npm run test-node-cjs + test-karma: + runs-on: ubuntu-latest + needs: [lint, test-node] + timeout-minutes: 10 + strategy: + matrix: + node-version: [24.x] + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v6 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - name: Run karma tests + run: npm run test-karma + coverage: + needs: [test-node, test-karma] + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + matrix: + node-version: [24.x] + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v6 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - name: Generate coverage report + run: npm run coverage-ci + - name: Upload coverage to Codecov + uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 + with: + files: ./coverage/lcov.info + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b4e925..b1b07c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # @digitalbazaar/http-client ChangeLog -## 4.2.1 - 2025-xx-xx +## 4.3.0 - 2026-01-xx + +### Changed +- Update dependencies. + - `ky@1.14.2`. + - `undici@6.23.0`. +- Update dev dependencies. + - `eslint@9`. + - `eslint-config-digitalbazaar` to `@digitalbazaar/eslint-config@7`. +- Update test dependencies. ### Fixed - Update HTTPS test endpoint from dead service to to github.com. May hit rate diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..45e2405 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,5 @@ +import config from '@digitalbazaar/eslint-config/universal-recommended'; + +export default [ + ...config +]; diff --git a/karma.conf.cjs b/karma.conf.cjs index cdabdc6..b9377fc 100644 --- a/karma.conf.cjs +++ b/karma.conf.cjs @@ -10,7 +10,7 @@ module.exports = async function(config) { //httpServer, //httpsServer, httpHost: testHttpHost, - httpsHost: testHttpsHost, + httpsHost: testHttpsHost } = await startServers(); config.set({ diff --git a/lib/agentCompatibility.js b/lib/agentCompatibility.js index 80a7aa5..edf24c1 100644 --- a/lib/agentCompatibility.js +++ b/lib/agentCompatibility.js @@ -47,7 +47,6 @@ function createFetch(dispatcher) { return function fetch(...args) { dispatcher = (args[1] && args[1].dispatcher) || dispatcher; args[1] = {...args[1], dispatcher}; - // eslint-disable-next-line no-undef return globalThis.fetch(...args); }; } diff --git a/lib/deferred.js b/lib/deferred.js index 06ec4a0..3a41152 100644 --- a/lib/deferred.js +++ b/lib/deferred.js @@ -13,6 +13,6 @@ export function deferred(f) { onfulfilled, onrejected ); - }, + } }; } diff --git a/package.json b/package.json index 128c04c..6c2ba20 100644 --- a/package.json +++ b/package.json @@ -30,27 +30,25 @@ "coverage": "cross-env NODE_ENV=test c8 npm run test-node", "coverage-ci": "cross-env NODE_ENV=test c8 --reporter=lcovonly --reporter=text-summary --reporter=text npm run test-node", "coverage-report": "c8 report", - "lint": "eslint --ext .cjs,.js --ignore-pattern rollup.config.js ." + "lint": "eslint" }, "files": [ "lib/*", "dist/*" ], "dependencies": { - "ky": "^1.7.5", - "undici": "^6.21.2" + "ky": "^1.14.2", + "undici": "^6.23.0" }, "devDependencies": { + "@digitalbazaar/eslint-config": "^7.0.0", "c8": "^10.1.3", "chai": "^4.5.0", "cors": "^2.8.5", - "cross-env": "^7.0.3", + "cross-env": "^10.1.0", "detect-node": "^2.1.0", - "eslint": "^8.57.1", - "eslint-config-digitalbazaar": "^5.2.0", - "eslint-plugin-jsdoc": "^50.6.9", - "eslint-plugin-unicorn": "^56.0.1", - "express": "^4.21.2", + "eslint": "^9.39.2", + "express": "^5.2.1", "karma": "^6.4.4", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^3.2.0", @@ -58,10 +56,10 @@ "karma-mocha-reporter": "^2.2.5", "karma-sourcemap-loader": "^0.4.0", "karma-webpack": "^5.0.1", - "mocha": "^11.1.0", - "rimraf": "^6.0.1", - "rollup": "^4.37.0", - "webpack": "^5.98.0" + "mocha": "^11.7.5", + "rimraf": "^6.1.2", + "rollup": "^4.55.1", + "webpack": "^5.104.1" }, "repository": { "type": "git", diff --git a/tests/10-client-api.spec.common.cjs b/tests/10-client-api.spec.common.cjs index c9edde0..02b4ebc 100644 --- a/tests/10-client-api.spec.common.cjs +++ b/tests/10-client-api.spec.common.cjs @@ -6,7 +6,8 @@ exports.test = function({ kyPromise, httpClient, DEFAULT_HEADERS, isNode, utils }) { -/* eslint-disable indent */ +/* eslint-disable @stylistic/indent */ +/* global after, before, describe, it, should */ describe('http-client API', () => { // start/close local test server let serverInfo; @@ -181,7 +182,7 @@ describe('http-client API', () => { const url = `http://${httpHost}/delay/2`; try { response = await httpClient.get(url, { - timeout: 1000, + timeout: 1000 }); } catch(e) { err = e;