I know that turbowatch was motivated by challenges working in a monorepo, but the available examples don't really cover how you would do something like setting up build watches for an app's dependencies then triggering app restarts after they finish building. I see two options, but it's not clear what the implications would be for choosing to use multiple projects versus multiple triggers. I started off with looking into the latter option because I like the idea of managing all the watch tasks in one place, but I don't see how you can change the working directory for the commands that are run in the trigger, for example, running tsc inside of a dependency directory. This makes me think that maybe the pattern is instead to have multiple turbowatch.ts files, one for each package in a monorepo, but that seems like it might be harder to maintain than one project with multiple triggers.
Desired Behavior
There might be a few things that would make it easier to get started:
Link to an example monorepo project showcasing recommended practices
Describe when you would use multiple triggers versus multiple turbowatch files
Explain how spawn works in better details. Is it just a copy of the $ object from zx? Is there a way to access the cd function from zx, or is spawn the only thing available for running commands? Can you run cd inside of the spawn command, an if you do so is the CWD scoped to the invoke of your trigger or is it a global context? Side note, it'd be nice if you could just specify a working directory on an individual trigger level.
Motivation
The docs are pretty good for showing how to set up a single watch task, but it'd be good to see a clear setup for how to use in a monorepo, leaning heavily on "typical" tasks like linting and tsc.
I know that turbowatch was motivated by challenges working in a monorepo, but the available examples don't really cover how you would do something like setting up build watches for an app's dependencies then triggering app restarts after they finish building. I see two options, but it's not clear what the implications would be for choosing to use multiple projects versus multiple triggers. I started off with looking into the latter option because I like the idea of managing all the watch tasks in one place, but I don't see how you can change the working directory for the commands that are run in the trigger, for example, running
tsc
inside of a dependency directory. This makes me think that maybe the pattern is instead to have multipleturbowatch.ts
files, one for each package in a monorepo, but that seems like it might be harder to maintain than one project with multiple triggers.Desired Behavior
There might be a few things that would make it easier to get started:
spawn
works in better details. Is it just a copy of the$
object fromzx
? Is there a way to access thecd
function fromzx
, or isspawn
the only thing available for running commands? Can you runcd
inside of the spawn command, an if you do so is the CWD scoped to the invoke of your trigger or is it a global context? Side note, it'd be nice if you could just specify a working directory on an individual trigger level.Motivation
The docs are pretty good for showing how to set up a single watch task, but it'd be good to see a clear setup for how to use in a monorepo, leaning heavily on "typical" tasks like linting and
tsc
.