-
Notifications
You must be signed in to change notification settings - Fork 214
Replace events with generic event 'run' #222
Conversation
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.
The intent from #166 was to have additional events so we can have a generic event to listen for, but we still need the specific events so things only happen during certain phases. For example, a preset like Jest only wants to run Jest when the test
event is ready. If we switch to run
only, this wouldn't be possible.
The solution would be to keep the current events, but add 2 additional chains: one for prerun
, and one for run
.
Codecov Report
@@ Coverage Diff @@
## v6-dev #222 +/- ##
==========================================
- Coverage 94.15% 93.61% -0.54%
==========================================
Files 36 36
Lines 513 517 +4
==========================================
+ Hits 483 484 +1
- Misses 30 33 +3
Continue to review full report at Codecov.
|
Makes sense, sorry I misread. |
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.
Looks good so far, just a nit and I think we can merge!
packages/neutrino/src/index.js
Outdated
@@ -15,12 +16,18 @@ const run = (command, middleware, options) => { | |||
.map(() => api.config.merge(options.config)) | |||
// Trigger all pre-events for the current command | |||
.chain(() => Future.fromPromise2(api.emitForAll, `pre${command}`, api.options.args)) | |||
// Trigger generic pre-event | |||
.chain(() => Future.fromPromise2(api.emitForAll, `pre${genericEvent}`, api.options.args)) |
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.
I'm fine with inlining the prerun
name here:
.chain(() => Future.fromPromise2(api.emitForAll, `prerun`, api.options.args))
packages/neutrino/src/index.js
Outdated
// Execute the command | ||
.chain(() => api.run(command)) | ||
// Trigger all post-command events, resolving with the value of the command execution | ||
.chain(value => Future | ||
.fromPromise2(api.emitForAll, command, api.options.args) | ||
.chain(() => Future.of(value))) | ||
// Trigger generic post-event, resolving with the value of the command execution | ||
.chain(value => Future | ||
.fromPromise2(api.emitForAll, genericEvent, api.options.args) |
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.
I'm fine with inlining the run
name here:
.fromPromise2(api.emitForAll, 'run', api.options.args)
🎉 |
No description provided.