Skip to content

WaitFor compatibility with Node watch processes (non-exiting background process) #8077

@tdhatcher

Description

@tdhatcher

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"

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<T> extension

WaitFor(IResourceBuilder<IResource> dependency, string message)
WaitForWithMessage(IResourceBuilder<IResource> dependency, string message)

Usage Examples

// 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions