-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
watch
Command - watch files/dirs and rerun task on change
#33
Conversation
lib/index.js
Outdated
function checkTypes(task, types) { | ||
return types.some(type => type === task.type) | ||
} | ||
|
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.
Why pull this out? I don't disagree with the change, just trying to understand.
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.
Because it's needed in the MaidRunner 😄
lib/FileWatcher.js
Outdated
.on('change', path => runner.runFile(this.getTaskName(path))) | ||
.on('unlink', path => runner.runFile(this.getTaskName(path))) | ||
.on('add', path => | ||
this.getTaskNames(path).forEach(taskName => runner.runFile(taskName)) |
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.
synchronous forEach
which executes async runFile
? Ouch.
…ending on the task name
@olstenlarck just made the task executions asynchronous :) |
) | ||
) + LAZY, | ||
capture(and(space, 'and', space, 'watch', space, capture(extra(ANY)))) + LAZY, | ||
wildcard(SPACE) |
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.
So when I implemented #23, I shortened this to only key off of Runs? tasks?
. It loosens the general word order. You know need to include this
for example. This reintroduces those changes plus some. Let's talk through ways of expressing watch
without requiring such a rigid expression.
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 can take out the this
to be optional
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.
Actually, this now enables several expressions:
Run task `lint` in parallel and watch ...
Run tasks `lint`, `build` and `clean` in parallel and watch ...
Run task `lint` after this / before this in parallel and watch ...
Run task `lint` and watch ...
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.
And I really don't think the user feels more convinient writing
Run task `lint` after in parallel
instead of
Run task `lint` after this in parallel
as latter would be a proper sentence
This isn't immediately clear to me...
What's the actual intent? Watch all js files for changes and when a change happens rerun lint? Does the actual task that the What about complex expressions? Let's say I'm running a command
Maybe static runs and watch runs shouldn't be in the same sentence. It might be shorter that way, but it's not necessarily any more clear. Thoughts @flxwu? |
@@ -1,6 +1,11 @@ | |||
const chokidar = require('chokidar') | |||
const logger = require('./logger') | |||
|
|||
Array.prototype.asyncForEach = async function(callback) { // eslint-disable-line |
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.
Ouch, why? I just really can't believe what i'm looking 🤣
p-map-series
or p-map
is probably better fit.
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.
Hmm... I missed that. Yeah, probably don't want to modify the prototype.
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.
okay thanks @olstenlarck
will run Your
If you want to run
However, this is not implemented yet I think, or is it? I mean multiline tasks @zephraph @olstenlarck @egoist |
@flxwu seems like it works, but not correctly. ### baw
Some sample task
Run task `foo` after this
Run task `bar` after this
```bash
echo "baaaawww"
```
### foo
Somedadadadad
```bash
echo "foo"
```
### bar
Sosasasas
```bash
echo "bar"
```
outputs
btw, does this PR support another than
kinda thing? |
Does it work in the current version? @olstenlarck |
dont know, didnt thought to try. |
Definitely should not support |
huh, why not? |
It's not really needed, is it? #23 loosens the restrictions so |
@egoist Are you going to merge this or what is still missing? 😄 |
@flxwu I have access to start merging, would you fix the conflicts and I will merge today. Thanks. |
Done! @jakepearson |
Resolves #9
Example
will rerun
lint
everytime a JavaScript file is changed