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

feat: pass custom options #4

Merged
merged 5 commits into from
Feb 17, 2017
Merged

feat: pass custom options #4

merged 5 commits into from
Feb 17, 2017

Conversation

shaoshuai0102
Copy link
Contributor

@shaoshuai0102 shaoshuai0102 commented Feb 17, 2017

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@shaoshuai0102 shaoshuai0102 self-assigned this Feb 17, 2017
@mention-bot
Copy link

@shaoshuai0102, thanks for your PR! By analyzing the history of the files in this pull request, we identified @luckydrq to be a potential reviewer.

@shaoshuai0102
Copy link
Contributor Author

cc @alphatr

@codecov
Copy link

codecov bot commented Feb 17, 2017

Codecov Report

Merging #4 into master will increase coverage by 2.63%.
The diff coverage is 81.81%.

@@            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
Impacted Files Coverage Δ
agent.js 100% <ø> (+10%)
app.js 100% <ø> (+11.11%)
lib/event-sources/default.js 85.71% <66.66%> (+10.71%)
lib/watcher.js 83.87% <87.5%> (+0.53%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d972db...efee030. Read the comment docs.

@shaoshuai0102
Copy link
Contributor Author

  • packae name egg-watcher-chokidar
  • plugin name watcherChokidar
  • config config.watcherChokidar
  • type config.watcher.type: 'watcherChokidar'
  • eventSourceName: watcherChokidar

@shaoshuai0102
Copy link
Contributor Author

// config.default.js
exports.watcher = {
  eventSources: {
    watcherChockidar: require('../path'),
  },
}

@shaoshuai0102
Copy link
Contributor Author

shaoshuai0102 commented Feb 17, 2017

Is that ok? @alphatr

@atian25
Copy link
Member

atian25 commented Feb 17, 2017

eventSource.type, chockidar -> watcherChockidar 感觉有点多余

@shaoshuai0102
Copy link
Contributor Author

那我改一下 加个规则

@shaoshuai0102
Copy link
Contributor Author

好了

@atian25
Copy link
Member

atian25 commented Feb 17, 2017

改下 #4 (comment) 的描述

@shaoshuai0102
Copy link
Contributor Author

shaoshuai0102 commented Feb 17, 2017

  • packae name egg-watcher-chokidar
  • plugin name watcherChokidar
  • config config.watcherChokidar
  • type config.watcher.type: watcherChokidar chokidar
  • eventSourceName: watcherChokidar chokidar

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`).
Copy link
Member

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
Copy link
Member

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

Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

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

这里感觉可以 recommend

@atian25
Copy link
Member

atian25 commented Feb 17, 2017

// config.default.js
 exports.watcher = {
   eventSources: {
     custom: require('../lib/custom_event_source'),
   },
 };

这里也得改, 不然对不上号

@alphatr
Copy link

alphatr commented Feb 17, 2017

@shaoshuai0102 OK, 看样子没问题

@shaoshuai0102
Copy link
Contributor Author

改好了 @atian25

Copy link
Member

@atian25 atian25 left a comment

Choose a reason for hiding this comment

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

各吧

@shaoshuai0102 shaoshuai0102 merged commit cf9fcac into master Feb 17, 2017
@shaoshuai0102 shaoshuai0102 deleted the pass-custom-options branch February 17, 2017 10:25
@shaoshuai0102
Copy link
Contributor Author

@atian25 帮发个版本 另外 npm owner 加下我

@atian25
Copy link
Member

atian25 commented Feb 17, 2017

让他们给下,我在外面

@shaoshuai0102
Copy link
Contributor Author

@popomore 你来

@atian25
Copy link
Member

atian25 commented Feb 20, 2017

发了.

➜  egg-watcher git:(master) npm owner ls egg-security
atian25 <atian25@qq.com>
dead_horse <dead_horse@qq.com>
eggjs <fengmk2+eggjs@gmail.com>
fengmk2 <fengmk2@gmail.com>
jtyjty99999 <jtyjty99999@126.com>
popomore <sakura9515@gmail.com>
shaoshuai0102 <shaoshuai0102@gmail.com>

fengmk2 pushed a commit that referenced this pull request Dec 18, 2024
[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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants