build(opentrons): add onchange watch to make format command #4804
+105
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add onchange lib to conditionally watch files using make format watch=true command and invoke
prettier on changed file
overview
Added
onchange
library recommended by prettier https://github.com/prettier/prettier/blob/master/docs/watching-files.md.Initially tried to implement using
watchman
but proved to be quite difficult / could potentially require additional implied dependencies. Onchange is nice because now it requires no additional setups for engineers to begin watching for changes and running prettier.Curious about watchman issues / have other ideas? These were my findings:
watchman-wait . -p '**/*.js' -m 0 | xargs prettier --write
.-m 0
disables themax-limit
, so the task can continue to run but unfortunately did not allow me to pipe the stdout into prettier.Watchman-wait
docs: https://facebook.github.io/watchman/docs/watchman-wait.htmlreview requests
Open to different implementation suggestions and there are way to make this work with watchman but the ones I could think of seem unnecessarily burdensome to do a simple task like this.