Skip to content

Add installation validation with user notifications for JavaScript package managers - #12840

Closed
David Fowler (davidfowl) with Copilot wants to merge 3 commits into
mainfrom
copilot/update-aspire-hosting-js
Closed

David Fowler (davidfowl) with Copilot wants to merge 3 commits into
mainfrom
copilot/update-aspire-hosting-js

Conversation

Copilot AI commented Nov 8, 2025 •

Copy link
Copy Markdown
Contributor

Description

Adds installation validation for Node.js and JavaScript package managers (npm, yarn, pnpm) following the same pattern from #12787 for Python/uv. When commands are missing, users see notifications with installation links rather than cryptic errors.

Shared Infrastructure

  • Added CoalescingAsyncOperation.cs and RequiredCommandValidator.cs references from src/Shared/ as internal shared source
  • Compiled into project via <Compile Include="$(SharedDir)..."> references

Validation Managers

Created four installation managers extending RequiredCommandValidator:

  • NodeInstallationManager - validates node command
  • NpmInstallationManager - validates npm command
  • YarnInstallationManager - validates yarn command
  • PnpmInstallationManager - validates pnpm command

Each provides EnsureInstalledAsync(bool throwOnFailure = true) and help links to installation docs.

Integration Points

Service Registration:

  • NodeInstallationManager in: AddNodeApp, AddJavaScriptApp, AddViteApp
  • Package manager validators in: WithNpm, WithYarn, WithPnpm

Validation Hooks:

  • Added OnBeforeResourceStarted hook on JavaScriptInstallerResource
  • Node validation runs first (all package managers require Node)
  • Package manager validation runs based on configured manager (npm/yarn/pnpm)
  • Uses throwOnFailure: false to show notifications without altering natural error flow

Behavior

When a command is missing:

  1. Warning logged
  2. Notification shown via IInteractionService with installation link
  3. App continues startup and fails naturally with original error
  4. Existing error behavior preserved

Example notification:

Missing command: node
Required command 'node' was not found. See installation instructions for more details.
[Installation instructions] → https://nodejs.org/en/download/

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
    • No
Original prompt

Make the same change in #12787 but for Aspire.Hosting.JavaScript. yarn, npm, pnpm and node.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…m, yarn, pnpm)

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Aspire.Hosting.JavaScript dependencies Add installation validation with user notifications for JavaScript package managers Nov 8, 2025
@github-actions

github-actions Bot commented Nov 8, 2025 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12840

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12840"

…le places call with the command to validate.
@dotnet-policy-service dotnet-policy-service Bot added this to the 13.1 milestone Nov 22, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 23, 2025
@sebastienros
Sébastien Ros (sebastienros) deleted the copilot/update-aspire-hosting-js branch January 15, 2026 16:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants