diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index eaf2ed6..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - root: true, - parserOptions: { - // this is required for dynamic import() - ecmaVersion: 2020 - }, - env: { - node: true - }, - extends: ['digitalbazaar', 'digitalbazaar/jsdoc'], - ignorePatterns: ['node_modules/'] -}; diff --git a/.github/workflows/main.yml b/.github/workflows/main.yaml similarity index 68% rename from .github/workflows/main.yml rename to .github/workflows/main.yaml index 4862d50..19660aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yaml @@ -8,11 +8,11 @@ jobs: timeout-minutes: 10 strategy: matrix: - node-version: [14.x] + node-version: [24.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - run: npm install @@ -24,11 +24,11 @@ jobs: timeout-minutes: 10 strategy: matrix: - node-version: [14.x, 16.x] + node-version: [20.x, 22.x, 24.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - run: | @@ -45,23 +45,19 @@ jobs: timeout-minutes: 10 strategy: matrix: - node-version: [14.x] + node-version: [24.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - - run: | - npm install - cd test - npm install + - run: npm install - name: Generate coverage report - run: | - cd test - npm run coverage-ci + run: npm run coverage-ci - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v5 with: - file: ./coverage/lcov.info + files: ./coverage/lcov.info fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1ac4e85..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - "14" - -notifications: - email: - on_success: change - on_failure: change diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e0f2dc..8e9c4fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # async-node-events ChangeLog +## 4.0.0 - 2026-xx-xx + +### Changed +- **BREAKING**: Only support Node.js >=20. +- Update dev dependencies. + +### Fixed +- Add `package.json` `files` field. + ## 3.0.0 - 2022-04-13 ### Changed diff --git a/README.md b/README.md index 9b12f91..81f118e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# async-node-events +# @digitalbazaar/async-node-events [![NPM Version](https://img.shields.io/npm/v/async-node-events.svg?style=flat-square)](https://npm.im/async-node-devents) -[![Build Status](https://travis-ci.org/digitalbazaar/async-node-events.png?branch=master)](https://travis-ci.org/digitalbazaar/async-node-events) +[![Build Status](https://img.shields.io/github/actions/workflow/status/digitalbazaar/bedrock/main.yaml)](https://github.com/digitalbazaar/bedrock/actions/workflows/main.yaml) An EventEmitter replacement that allows both asynchronous and synchronous emissions and handlers. This is entirely based off of and almost entirely @@ -33,14 +33,14 @@ use ``emitSync`` to emit ``newListener``, ``removeListener``, and ## Install ```sh -npm install async-node-events +npm install @digitalbazaar/async-node-events ``` ## Usage ```js -var EventEmitter = require('async-node-events').EventEmitter; -var util = require('util'); +import {EventEmitter} from '@digitalbazaar/async-node-events'; +const util = require('node:util'); (async () => { const myEmitter = new EventEmitter(); @@ -61,7 +61,8 @@ util.inherits(MyEmittingObject, EventEmitter); The API is intended to be a mostly-drop-in replacement for Node.js' `EventEmitter` object, except with support for asynchronous listeners. -The primary differences between the `EventEmitter` and `async-node-events` are: +The primary differences between the `EventEmitter` and +`@digitalbazaarasync-node-events` are: 1. Passing the maximum number of listeners allowed will fire off a ``maxListenersPassed`` event with the event name and listener count as 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/package.json b/package.json index b830212..9ec9755 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "type": "module", "description": "Asynchronous EventEmitter", "scripts": { - "lint": "eslint 'lib/*.js' 'test/*.js'", + "lint": "eslint", "coverage": "cross-env NODE_ENV=test c8 --reporter=lcov --reporter=text-summary npm test", "coverage-ci": "cross-env NODE_ENV=test c8 --reporter=lcovonly npm test", "coverage-report": "c8 report", @@ -34,22 +34,23 @@ "url": "https://github.com/digitalbazaar/async-node-events" }, "main": "./lib/index.js", + "files": [ + "lib/**/*.js" + ], "dependencies": { "is-promise": "^4.0.0" }, "devDependencies": { - "c8": "^7.11.0", - "chai": "^4.3.6", - "cross-env": "^7.0.3", - "eslint": "^7.32.0", - "eslint-config-digitalbazaar": "^2.8.0", - "eslint-plugin-jsdoc": "^39.2.1", - "jsdoc-to-markdown": "^7.1.1", - "mocha": "^9.2.2", + "@digitalbazaar/eslint-config": "^8.0.1", + "c8": "^11.0.0", + "chai": "^6.2.2", + "cross-env": "^10.1.0", + "eslint": "^9.39.3", + "mocha": "^11.7.5", "mocha-lcov-reporter": "^1.3.0" }, "engines": { - "node": ">=14" + "node": ">=20" }, "c8": { "exclude": [ diff --git a/test/.eslintrc.cjs b/test/.eslintrc.cjs deleted file mode 100644 index bf3479f..0000000 --- a/test/.eslintrc.cjs +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - env: { - mocha: true - } -}; diff --git a/test/event-emitter.js b/test/event-emitter.js index 84486ef..658f0e3 100644 --- a/test/event-emitter.js +++ b/test/event-emitter.js @@ -1,5 +1,5 @@ -import {expect} from 'chai'; import {EventEmitter} from '../lib/index.js'; +import {expect} from 'chai'; describe('EventEmitter', function() { describe('#constructor', function() {