Hi Jeff,
I'm writing a thing that runs Node.js tests faster. Currently we pay a ~6-10s penalty to run a single test, and the majority of this time is spent requireing a shitload of files.
Instead I'm writing a server which loads every dependency at boot. You can POST to it to invalidate the cache for a specific file, or to start a test run. It's looking pretty good so far, test runs complete with about 10ms of overhead vs 6-10s. I have a companion command line tool for the server.
What I want is to write a watcher that listens for changes to any file in the project, then invalidates the cache for that file, e.g.
- Detect change to
api/models/Users
- Run
lucifer invalidate api/models/Users to clear the cache for it.
Unfortunately it seems like justrun only runs statically defined commands. I was wondering how open you'd be to defining some kind of dynamic "file changed" syntax for the passed in command, eg find api -type f | justrun -stdin -c 'lucifer invalidate {{ file }}' or similar.
If I'm reading the code correctly, it wouldn't exactly be trivial. you'd have to modify the cmdCh channel to pass the changed file path as well as a time.Time object, then do some kind of interpolation in the for loop in main.go and pass the result to cmd.Start.
I'm happy to take a crack at it, but wanted to know if you were open to the idea, or had better thoughts about the interpolation syntax.
Hi Jeff,
I'm writing a thing that runs Node.js tests faster. Currently we pay a ~6-10s penalty to run a single test, and the majority of this time is spent
requireing a shitload of files.Instead I'm writing a server which loads every dependency at boot. You can POST to it to invalidate the cache for a specific file, or to start a test run. It's looking pretty good so far, test runs complete with about 10ms of overhead vs 6-10s. I have a companion command line tool for the server.
What I want is to write a watcher that listens for changes to any file in the project, then invalidates the cache for that file, e.g.
api/models/Userslucifer invalidate api/models/Usersto clear the cache for it.Unfortunately it seems like justrun only runs statically defined commands. I was wondering how open you'd be to defining some kind of dynamic "file changed" syntax for the passed in command, eg
find api -type f | justrun -stdin -c 'lucifer invalidate {{ file }}'or similar.If I'm reading the code correctly, it wouldn't exactly be trivial. you'd have to modify the
cmdChchannel to pass the changed file path as well as atime.Timeobject, then do some kind of interpolation in the for loop inmain.goand pass the result to cmd.Start.I'm happy to take a crack at it, but wanted to know if you were open to the idea, or had better thoughts about the interpolation syntax.