Skip to content

Automatically restore TypeScript starter SDK artifacts#15174

Merged
IEvangelist merged 2 commits intomicrosoft:release/13.2from
IEvangelist:dapine/aspire-restore-post-ts-starter
Mar 12, 2026
Merged

Automatically restore TypeScript starter SDK artifacts#15174
IEvangelist merged 2 commits intomicrosoft:release/13.2from
IEvangelist:dapine/aspire-restore-post-ts-starter

Conversation

@IEvangelist
Copy link
Copy Markdown
Member

Description

Automatically restore TypeScript starter projects as part of aspire new so the generated .modules SDK is available immediately after creation.

Fixes #15169

This change updates the TypeScript starter template finalization flow to use the guest AppHost restore/code generation pipeline directly instead of spawning a nested CLI process. That keeps the restore behavior aligned with the existing guest project infrastructure, avoids the hanging child-process path seen in automation, and ensures the selected channel is written before restore/package resolution runs.

The implementation also keeps the generated project behavior correct by letting aspire restore own guest dependency installation and SDK generation rather than layering an extra template-specific npm install step on top. For validation, the change adds focused CLI-level coverage for the TypeScript starter restore path and updates the existing scenario assertion to verify the generated .modules/aspire.ts artifact without assuming emitted .js files.

Validation:

  • dotnet test tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj -- --filter-method "*.NewCommandWithTypeScriptStarterGeneratesSdkArtifacts" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • dotnet test tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj -- --filter-class "*.NewCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • dotnet test tests/Aspire.Cli.EndToEnd.Tests/Aspire.Cli.EndToEnd.Tests.csproj -- --filter-class "*.TypeScriptStarterTemplateTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" still fails locally in Docker terminal setup before the starter assertions run (the input device is not a TTY / container-ready timeout), so that scenario was not revalidated end-to-end on this machine.

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
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings March 12, 2026 15:51
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 12, 2026

🚀 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 -- 15174

Or

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the TypeScript starter template finalization so aspire new runs restore / SDK generation through the existing guest AppHost pipeline (instead of spawning a nested CLI / npm install), ensuring .modules artifacts are immediately available after creation.

Changes:

  • Inject IAppHostProjectFactory into CliTemplateFactory and use guest AppHost restore/codegen for TypeScript starter finalization.
  • Add CLI test coverage to validate .modules/aspire.ts generation and correct channel propagation before restore.
  • Update E2E scenario assertions to check for generated .modules/aspire.ts instead of emitted .js files.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs Updates test service wiring to pass IAppHostProjectFactory into CliTemplateFactory.
tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs Adds a focused CLI test and test doubles to validate TypeScript starter restore/codegen behavior.
tests/Aspire.Cli.EndToEnd.Tests/TypeScriptStarterTemplateTests.cs Adds a scenario assertion that .modules/aspire.ts exists after aspire new.
src/Aspire.Cli/Templating/CliTemplateFactory.cs Removes nested-process execution helpers and stores injected IAppHostProjectFactory.
src/Aspire.Cli/Templating/CliTemplateFactory.TypeScriptStarterTemplate.cs Switches TypeScript starter finalization to call guest restore/codegen and writes channel before restore.
src/Aspire.Cli/Projects/IGuestAppHostSdkGenerator.cs Introduces an internal interface to represent guest SDK generation.
src/Aspire.Cli/Projects/GuestAppHostProject.cs Implements IGuestAppHostSdkGenerator for the guest AppHost handler.

You can also share your feedback on Copilot code review. Take the survey.

@IEvangelist IEvangelist merged commit ae459f9 into microsoft:release/13.2 Mar 12, 2026
254 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants