WaitFor compatibility with Node watch processes (non-exiting background process)
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
## Background and Motivation
If an Aspire `AppHost` needs to particular sequence involving a Node script, this can be problematic.
Allow the state of a resource that is effectively a watch process without an exit to be affected by output text. The desired capability is similar to [`problemMatcher` in VS Code tasks that define an "endsPattern"](https://code.visualstudio.com/docs/editor/tasks#_background-watching-tasks)
Today if you run a Node app (eg. `ng serve`) it seems to prematurely indicate "readiness" while it's still executing. Any output indicating "readiness" is highly variable in nature due to script customizations and frameworks.
## Proposed API
`IResourceBuilder` extension
`WaitFor(IResourceBuilder dependency, string message)`
`WaitForWithMessage(IResourceBuilder dependency, string message)`
## Usage Examples
```csharp
// ng serve / watch
var angularClient = builder.AddNpmApp("client", "./apps/client1", "start");
// something to run only after npm project ready
var otherThing = builder.AddNpmApp("otherThing", "./apps/client2", "start")
.WaitForWithMessage(angularClient, "bundle generation complete");
```
## Alternative Designs
## Risks
Contributor guide
Assessment
This issue has not been assessed yet.