Skip to content

Refactor Node package installers to be a resource #732

@aaronpowell

Description

@aaronpowell

The Node package installers (npm, yarn and pnpm) in the Node.js extensions integration are built around the original life cycle hooks system in Aspire and it has some limitations, with the main one being that you don't have real visibility over the output of when npm install (or similar) is run.

Instead, I want to refactor this to move aware from events entirely and instead represent them as resources, meaning we'd have a NpmInstallerResource (or YarnInstallerResource/PnpmInstallerResource) that handles the install.

The advantage is that these can inherit from ExecutableResource and we can delegate the responsibility of their invocation to the DCP, rather than having to run Process.Start ourselves.

Also, since they are resources, they will appear on the dashboard, meaning you get the console logs from them (useful for diagnostics), we can observe their life cycle, and we can re-run them if desired.

They should be children of the Node.js resource, but they should force the parent resource to wait for their completion before starting - this would mean that a npm install failure would block the app from starting, since it's likely that it'd fail anyway.

Metadata

Metadata

Labels

integrationA new .NET Aspire integrationjavascriptPull requests that update Javascript code

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions