Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tdhatcher opened this issue Mar 14, 2025 · 1 comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Comments

@tdhatcher
Copy link

tdhatcher commented Mar 14, 2025

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

@github-actions github-actions bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Mar 14, 2025
@davidfowl
Copy link
Member

As an alternative you can add a http health check to your npm app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

No branches or pull requests

2 participants