-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: pass custom options #4
Conversation
@shaoshuai0102, thanks for your PR! By analyzing the history of the files in this pull request, we identified @luckydrq to be a potential reviewer. |
cc @alphatr |
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
==========================================
+ Coverage 81.7% 84.33% +2.63%
==========================================
Files 8 8
Lines 82 83 +1
==========================================
+ Hits 67 70 +3
+ Misses 15 13 -2
Continue to review full report at Codecov.
|
|
// config.default.js
exports.watcher = {
eventSources: {
watcherChockidar: require('../path'),
},
} |
Is that ok? @alphatr |
|
那我改一下 加个规则 |
好了 |
改下 #4 (comment) 的描述 |
|
README.md
Outdated
@@ -59,12 +59,17 @@ There's a built-in [development mode](https://github.com/eggjs/egg-watcher/blob/ | |||
|
|||
### Customize Watching Mode | |||
|
|||
Firstly define your custom event source like this: | |||
Say we want to build a custom event source plugin (package name: `egg-watcher-custom`, pluginName: `watcherCustom`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pluginName -> eggPlugin.name ?
README.md
Outdated
Firstly define your custom event source like this: | ||
Say we want to build a custom event source plugin (package name: `egg-watcher-custom`, pluginName: `watcherCustom`). | ||
|
||
Firstly define our custom event source like this: | ||
|
||
```js | ||
// custom_event_source.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// {plugin_root}/lib/custom_event_source.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
然后下面的那个
// config.default.js
exports.watcher = {
eventSources: {
custom: require('../lib/custom_event_source'),
},
};
README.md
Outdated
// this will pass to your CustomEventSource constructor as opts | ||
exports.watcherCustom = { | ||
// foo: 'bar', | ||
}; | ||
``` | ||
|
||
If possible, plugins named like `egg-watcher-${customName}`(`egg-watcher-vagrant` eg.) are welcomed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里感觉可以 recommend
// config.default.js
exports.watcher = {
eventSources: {
custom: require('../lib/custom_event_source'),
},
}; 这里也得改, 不然对不上号 |
@shaoshuai0102 OK, 看样子没问题 |
改好了 @atian25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
各吧
@atian25 帮发个版本 另外 npm owner 加下我 |
让他们给下,我在外面 |
@popomore 你来 |
发了.
|
[skip ci] ## 1.0.0 (2024-12-18) ### ⚠ BREAKING CHANGES * drop Node.js < 18.19.0 support part of eggjs/egg#3644 eggjs/egg#5257 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced new configuration files for managing watcher settings in different environments (default, local, unittest). - Added a new `Boot` class to manage application lifecycle and watcher initialization. - Implemented `Watcher` class for monitoring file changes with event handling. - Added `DevelopmentEventSource` and `DefaultEventSource` classes for specific event source management. - **Bug Fixes** - Enhanced path handling in various modules to ensure correct file watching functionality. - **Documentation** - Updated `README.md` with project name change and improved structure. - **Tests** - Introduced new unit tests for watcher functionality and refactored existing test files to improve clarity and structure. - **Chores** - Removed deprecated configuration files and streamlined project structure. - Updated TypeScript configuration for stricter type-checking. <!-- end of auto-generated comment: release notes by coderabbit.ai --> ### Features * [BREAK CHANGE] use cluster-client ([#2](#2)) ([90a8b47](90a8b47)) * add event source event logs ([#9](#9)) ([b351795](b351795)) * pass custom options ([#4](#4)) ([cf9fcac](cf9fcac)) * support cjs and esm both by tshy ([#14](#14)) ([c80fea0](c80fea0)) ### Bug Fixes * should support watch one file multiple times ([#6](#6)) ([6d84e21](6d84e21)) * spell error on watcher.js ([#13](#13)) ([9ab2eed](9ab2eed))
Checklist
npm test
passesAffected core subsystem(s)
Description of change