Skip to content

docs: replace removed AddNpmApp in AppHost samples with AddJavaScriptApp - #2015

Merged
David Pine (IEvangelist) merged 1 commit into
mainfrom
fix/remove-addnpmapp-samples
Nov 1, 2026
Merged

David Pine (IEvangelist) merged 1 commit into
mainfrom
fix/remove-addnpmapp-samples

Conversation

@davidfowl

Copy link
Copy Markdown
Contributor

Summary

AddNpmApp was removed in Aspire 13 and replaced by AddJavaScriptApp (see the Aspire 13 What's new). Several current, non-history AppHost samples still call it, so copying them gives a compile error ('IDistributedApplicationBuilder' does not contain a definition for 'AddNpmApp').

This PR updates those samples to AddJavaScriptApp(name, appDirectory), which matches the current Aspire.Hosting.JavaScript signature:

  • app-host/certificate-configuration.mdx (4 samples), plus the ja copy
  • architecture/resource-model.mdx (2 samples), plus the ja copy
  • architecture/resource-hierarchies.mdx, plus the ja copy. The old call AddNpmApp("web") also omitted the required app directory, so it now reads AddJavaScriptApp("web", "../web").
  • ja/get-started/what-is-aspire.mdx
  • components/ThreeTierAspire.astro (not currently imported anywhere; updated so the regression test can stay strict)

What's new pages are left alone because they describe AddNpmApp as history.

Regression test: tests/unit/removed-apphost-apis.vitest.test.ts scans src/content/docs and src/components (excluding whats-new) for calls to removed AppHost APIs.

Before / after (/architecture/resource-model/)

Before (live aspire.dev):

Before: resource-model sample calls builder.AddNpmApp

After (local dev server):

After: resource-model sample calls builder.AddJavaScriptApp

Third-party links and affiliations

None

Validation

  • npx vitest run tests/unit/removed-apphost-apis.vitest.test.ts: fails on main with 16 offenders and passes with this change.
  • prettier --check and eslint --max-warnings 0 pass on the changed files.
  • Rendered the updated page locally with astro dev and captured it with Playwright (above).

🤖 Posted by AspireAgent (AI Agent)

AddNpmApp was removed in Aspire 13. Update the certificate configuration,
resource model and resource hierarchy samples (English and Japanese), the
Japanese what-is-aspire sample and the ThreeTierAspire component, and add
a regression test that rejects removed AppHost APIs outside What's new.

Co-authored-by: Copilot <[email protected]>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #2015. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #2015 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

@davidfowl
David Fowler (davidfowl) marked this pull request as ready for review November 1, 2026 09:53
Copilot AI balanced review requested due to automatic review settings November 1, 2026 09:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the documentation API updates and accompanying regression test.

No open issues 🎉

What changed in this PR

Updates current AppHost examples on aspire.dev to use AddJavaScriptApp instead of the removed AddNpmApp API, while preserving historical references in What's new pages.

Changes:

  • Replaces 16 obsolete API calls across English and Japanese documentation and the three-tier example component.
  • Adds the required application directory to both resource-hierarchy examples.
  • Adds a regression test that scans documentation and components for removed API calls, excluding What's new pages.
File Description
src/​frontend/​tests/​unit/​removed-apphost-apis.vitest.test.ts Adds the removed-API regression scan.
src/​frontend/​src/​content/​docs/​ja/​get-started/​what-is-aspire.mdx Updates the Japanese introductory example.
src/​frontend/​src/​content/​docs/​ja/​architecture/​resource-model.mdx Updates two Japanese resource-model examples.
src/​frontend/​src/​content/​docs/​ja/​architecture/​resource-hierarchies.mdx Updates the API and supplies the application directory.
src/​frontend/​src/​content/​docs/​ja/​app-host/​certificate-configuration.mdx Updates four Japanese certificate examples.
src/​frontend/​src/​content/​docs/​architecture/​resource-model.mdx Updates two resource-model examples.
src/​frontend/​src/​content/​docs/​architecture/​resource-hierarchies.mdx Updates the API and supplies the application directory.
src/​frontend/​src/​content/​docs/​app-host/​certificate-configuration.mdx Updates four certificate examples.
src/​frontend/​src/​components/​ThreeTierAspire.astro Updates the embedded frontend-service example.

Review effort: Balanced

@IEvangelist
David Pine (IEvangelist) enabled auto-merge (squash) November 1, 2026 14:48
@IEvangelist
David Pine (IEvangelist) merged commit 07e6342 into main Nov 1, 2026
20 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the fix/remove-addnpmapp-samples branch November 1, 2026 14:49
David Pine (IEvangelist) pushed a commit that referenced this pull request Nov 3, 2026
…2004)

## Summary

This PR started as a fix for the Japanese [What is
Aspire?](https://aspire.dev/ja/get-started/what-is-aspire/) C# AppHost
sample, which called `AddNpmApp`. That API was removed in Aspire 13.
#2015 has since replaced the line on `main` with
`AddJavaScriptApp("frontend", "../frontend")`. After the rebase, this PR
keeps `main`'s line and is **test-only**.

**Change:** extend the regression test that #1998 added,
`tests/unit/get-started-apphost-apis.vitest.test.ts`.
- It now scans `get-started/` in every locale, not just English.
- It asserts that at least one localized `get-started` directory was
included, so the coverage can't silently drop.
- It normalizes path separators so the reported paths are stable on
Windows.

Without this change, a localized sample that calls an API missing from
the published `src/data/pkgs` data, like `AddNpmApp`, isn't caught.

Maintainers can close this PR if they don't want the extra guard.

## Third-party links and affiliations

None.

## Validation

- `npx vitest run tests/unit/get-started-apphost-apis.vitest.test.ts`
passes on the rebased head.
- Negative check: temporarily restoring `AddNpmApp` in
`ja/get-started/what-is-aspire.mdx` makes the test fail with that entry.
I then reverted the probe.

No screenshots, because this PR has no rendered changes.

**🤖 Posted by AspireAgent (AI Agent)**

---------

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
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