Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: import event source only default export #15

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
version: '18.19.0, 18, 20, 22'
version: '18.19.0, 18, 20, 22, 23'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Node.js 23 is not officially supported by the reusable workflow

The parent workflow (node-modules/github-actions/.github/workflows/node-test.yml) explicitly lists supported Node.js versions as "16, 18, 20, 22" in its default configuration. Adding Node.js 23 might lead to unexpected behavior since it's not part of the officially supported versions in the reusable workflow.

Consider:

  • Removing Node.js 23 from the test matrix
  • Or, open an issue/PR in the node-modules/github-actions repository to add support for Node.js 23 first
🔗 Analysis chain

Consider the implications of testing against Node.js 23

Node.js 23 is a current release (not LTS) with a shorter support window. While testing against it provides early feedback, be aware that:

  • It may contain breaking changes or experimental features
  • It has a shorter support lifecycle compared to LTS versions

Let's verify the parent workflow's compatibility:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the reusable workflow supports Node.js 23
# Expected: The workflow should explicitly list supported Node.js versions

curl -s https://raw.githubusercontent.com/node-modules/github-actions/master/.github/workflows/node-test.yml | grep -A 5 "version:"

Length of output: 842

secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# @eggjs/watcher

[![NPM version][npm-image]][npm-url]
[![Node.js CI](https://github.com/eggjs/egg-watcher/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-watcher/actions/workflows/nodejs.yml)
[![Node.js CI](https://github.com/eggjs/watcher/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/watcher/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[![Node.js Version](https://img.shields.io/node/v/@eggjs/watcher.svg?style=flat)](https://nodejs.org/en/download/)

[npm-image]: https://img.shields.io/npm/v/@eggjs/watcher.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@eggjs/watcher
[codecov-image]: https://codecov.io/github/eggjs/egg-watcher/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/eggjs/egg-watcher?branch=master
[codecov-image]: https://codecov.io/github/eggjs/watcher/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/eggjs/watcher?branch=master
[snyk-image]: https://snyk.io/test/npm/@eggjs/watcher/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@eggjs/watcher
[download-image]: https://img.shields.io/npm/dm/@eggjs/watcher.svg?style=flat-square
Expand Down Expand Up @@ -56,7 +56,7 @@ Stop watching file(s).

### `development` Mode

There's a built-in [development mode](https://github.com/eggjs/egg-watcher/blob/master/src/lib/event-sources/development.ts) which works in local(env is `local`). Once files on disk is modified it will emit a `change` event immediately.
There's a built-in [development mode](https://github.com/eggjs/watcher/blob/master/src/lib/event-sources/development.ts) which works in local(env is `local`). Once files on disk is modified it will emit a `change` event immediately.

### Customize Watching Mode

Expand Down Expand Up @@ -142,6 +142,6 @@ Please open an issue [here](https://github.com/eggjs/egg/issues).

## Contributors

[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-watcher)](https://github.com/eggjs/egg-watcher/graphs/contributors)
[![Contributors](https://contrib.rocks/image?repo=eggjs/watcher)](https://github.com/eggjs/watcher/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"ci": "egg-bin cov",
"prepublishOnly": "tshy && tshy-after"
},
"homepage": "https://github.com/eggjs/egg-watcher",
"homepage": "https://github.com/eggjs/watcher",
"repository": {
"type": "git",
"url": "[email protected]:eggjs/egg-watcher.git"
"url": "[email protected]:eggjs/watcher.git"
},
"keywords": [
"egg-watcher",
Expand Down
4 changes: 3 additions & 1 deletion src/lib/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class Watcher extends Base {
const watcherType = this.#config.watcher.type;
let EventSource: typeof BaseEventSource = this.#config.watcher.eventSources[watcherType] as any;
if (typeof EventSource === 'string') {
EventSource = await importModule(EventSource);
EventSource = await importModule(EventSource, {
importDefaultOnly: true,
});
}

// chokidar => watcherChokidar
Expand Down
Loading