-
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
fix: should export watcher from EggWatcherApplicationCore #16
Conversation
WalkthroughThe pull request introduces significant type refinements across multiple files in the project. The changes focus on streamlining the type definitions for the Egg framework's watcher functionality, specifically in Changes
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
commit: |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/lib/boot.ts (1)
12-14
: Consider combining the watcher initialization chain.The watcher initialization chain has been split across multiple lines. While this improves readability, consider combining the
create()
call with the chain for consistency.- this.#watcher = this.#app.watcher = this.#app.cluster(Watcher, {}) - .delegate('watch', 'subscribe') - .create(appOrAgent.config); + this.#watcher = this.#app.watcher = this.#app.cluster(Watcher, {}) + .delegate('watch', 'subscribe') + .create(appOrAgent.config)test/watcher.test.ts (1)
17-18
: Consider extracting log file paths to constants.The log file paths are repeated across multiple test cases. Consider extracting these to constants at the top of the file to improve maintainability.
const LOG_FILE_PATHS = { DEFAULT: getFilePath('apps/watcher-type-default/logs/watcher-type-default/egg-agent.log'), CUSTOM: getFilePath('apps/watcher-custom-event-source/logs/watcher-custom-event-source/egg-agent.log'), FUZZY: getFilePath('apps/watcher-custom-event-source-fuzzy/logs/watcher-custom-event-source-fuzzy/egg-agent.log'), };Also applies to: 35-36, 67-68
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/lib/boot.ts
(1 hunks)src/lib/types.ts
(2 hunks)test/watcher.test.ts
(4 hunks)
🔇 Additional comments (4)
src/lib/types.ts (2)
22-24
: LGTM! Type refinement improves clarity and accessibility.
The new EggWatcherApplicationCore
interface properly extends EggApplicationCore
and explicitly includes the watcher
property, which aligns with the PR objective to export the watcher.
26-26
: LGTM! Config type composition is clean.
The EggWatcherAppConfig
type correctly combines EggAppConfig
& WatcherConfig
using intersection types.
src/lib/boot.ts (1)
6-6
: LGTM! Type refinements improve type safety.
The constructor parameter and private member types are correctly updated to use EggWatcherApplicationCore
, aligning with the new type system.
Also applies to: 9-9
test/watcher.test.ts (1)
30-30
: LGTM! Type annotations improve type safety.
The watch callbacks now properly use the ChangeInfo
type, with appropriate type intersections where additional properties are expected.
Also applies to: 44-44, 61-61
[skip ci] ## [4.0.2](v4.0.1...v4.0.2) (2024-12-20) ### Bug Fixes * should export watcher from EggWatcherApplicationCore ([#16](#16)) ([59a1880](59a1880))
Summary by CodeRabbit
New Features
EggWatcherApplicationCore
for improved application structure.EggWatcherAppConfig
for simplified configuration management.Bug Fixes
Refactor
Boot
class for clarity and specificity.Tests