Rename JavaScript package script publish API - #17382
Conversation
Rename the JavaScript publish API from PublishAsNpmScript to PublishAsPackageScript and shorten the script option name from startScriptName to scriptName. Update C# and TypeScript call sites, playground docs, agent guidance, and Verify snapshot names. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17382Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17382" |
There was a problem hiding this comment.
Pull request overview
Renames the JavaScript “publish as package-manager script” API to remove npm-specific naming, aligning the public surface with the implementation that supports npm, pnpm, Yarn, and Bun across C# and TypeScript AppHosts and their associated docs/tests.
Changes:
- Renames
PublishAsNpmScript/publishAsNpmScripttoPublishAsPackageScript/publishAsPackageScript, including option renamestartScriptName→scriptName. - Updates hosting internals (
JavaScriptPublishMode, annotations, Dockerfile generation) and propagates the new naming through call sites, docs, and agent reference guidance. - Updates/introduces Verify snapshots and end-to-end fixtures to assert Dockerfile/runtime behavior for different package managers.
Show a summary per file
| File | Description |
|---|---|
| tests/PolyglotAppHosts/Aspire.Hosting.JavaScript/TypeScript/apphost.ts | Updates TypeScript polyglot AppHost usage to publishAsPackageScript. |
| tests/Aspire.Hosting.JavaScript.Tests/Snapshots/AddViteAppTests.VerifyDockerfileWhenPackageScriptUsesPnpm.verified.txt | Adds/updates expected Dockerfile snapshot for pnpm package-script publish. |
| tests/Aspire.Hosting.JavaScript.Tests/Snapshots/AddViteAppTests.VerifyDockerfileWhenPackageScriptUsesBun.verified.txt | Adds/updates expected Dockerfile snapshot for Bun package-script publish. |
| tests/Aspire.Hosting.JavaScript.Tests/Snapshots/AddJavaScriptAppTests.VerifyPnpmDockerfileWhenPublishedAsPackageScript_hasLockFile=True.verified.txt | Adds/updates expected Dockerfile snapshot for pnpm (lockfile present). |
| tests/Aspire.Hosting.JavaScript.Tests/Snapshots/AddJavaScriptAppTests.VerifyPnpmDockerfileWhenPublishedAsPackageScript_hasLockFile=False.verified.txt | Adds/updates expected Dockerfile snapshot for pnpm (no lockfile). |
| tests/Aspire.Hosting.JavaScript.Tests/Snapshots/AddJavaScriptAppTests.VerifyDockerfileWhenPublishedAsPackageScript.verified.txt | Adds/updates expected Dockerfile snapshot for generic package-script publish. |
| tests/Aspire.Hosting.JavaScript.Tests/NodeJsPublicApiTests.cs | Renames/adjusts public API validation tests for new method/parameter names. |
| tests/Aspire.Hosting.JavaScript.Tests/AddViteAppTests.cs | Updates Vite publish tests to use PublishAsPackageScript and renamed test methods. |
| tests/Aspire.Hosting.JavaScript.Tests/AddJavaScriptAppTests.cs | Updates JavaScript app publish tests and outerloop description for new API name. |
| tests/Aspire.Cli.EndToEnd.Tests/TypeScriptPublishTests.cs | Updates TS publish E2E fixture code to publishAsPackageScript. |
| tests/Aspire.Cli.EndToEnd.Tests/JavaScriptPublishTests.cs | Updates E2E test description and TS AppHost snippet to new API naming. |
| tests/Aspire.Cli.EndToEnd.Tests/Fixtures/JsPublish/verify.sh | Updates fixture verification to expect PublishAsPackageScript. |
| tests/Aspire.Cli.EndToEnd.Tests/Fixtures/JsPublish/npmscript/server.js | Updates fixture server response payload to new method name. |
| src/Aspire.Hosting.JavaScript/JavaScriptPublishModeAnnotation.cs | Renames publish mode enum/member and related annotation properties. |
| src/Aspire.Hosting.JavaScript/JavaScriptPackageManagerAnnotation.cs | Renames internal runtime-image resolver callback to package-script terminology. |
| src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs | Renames the public publish API, updates Dockerfile generation path and error message. |
| playground/AspireWithNode/README.md | Updates sample documentation to reference PublishAsPackageScript. |
| playground/AspireWithNode/AspireWithNode.AppHost/AppHost.cs | Updates sample AppHost to call PublishAsPackageScript. |
| playground/AspireWithJavaScript/AspireJavaScript.AppHost/AppHost.cs | Updates commented guidance/examples to the new API name and option name. |
| .agents/skills/aspire-deployment/references/javascript.md | Updates agent reference material to use PublishAsPackageScript. |
Copilot's findings
- Files reviewed: 15/20 changed files
- Comments generated: 2
Update the PublishAsPackageScript XML doc example to describe package-manager agnostic behavior for npm, pnpm, Yarn, and Bun. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thanks for the review summary. I accepted the XML-doc clarification and pushed a fix, and I declined the generated API baseline request because this repository refreshes src//api/.cs baselines during the release process rather than in individual PRs. |
|
Copilot resolve the merge conflicts in this pull request |
Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Resolved by merging |
Declare the intentional TypeScript API break for renaming publishAsNpmScript to publishAsPackageScript. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ipt' into davidfowl/rename-publishasnpmscript
|
❓ CLI E2E Tests unknown — 96 passed, 0 failed, 5 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26324437565 |
|
✅ No documentation update needed. Docs PR was drafted locally (branch |
Reverts the subset of API changes from the previous commit that would be
binary-breaking against 13.3.5, and bumps PackageValidationBaselineVersion
from 13.2.2 to 13.3.5 so pack validation runs against the latest shipped
release.
Reverts (binary-breaking against 13.3.5):
- AllocatedEndpoint.NetworkID (kept ctor param 'networkId' - not breaking)
- EndpointAnnotation.DefaultNetworkID (kept ctor param 'networkId')
- EndpointReference.ContextNetworkID (kept ctor param 'contextNetworkId')
- NetworkEndpointSnapshot.NetworkID record positional param
- Removed 'sealed' from 9 shipped resource classes:
- NextJsAppResource, ViteAppResource
- AzureNatGatewayResource, AzureNetworkSecurityGroupResource,
AzureNetworkSecurityPerimeterResource, AzurePrivateEndpointResource,
AzurePublicIPAddressResource, AzureSubnetResource, AzureVirtualNetworkResource
Kept (not binary-breaking):
- All constructor/method parameter renames (networkID->networkId, etc.)
- EndpointReferenceAnnotation.ContextNetworkId (new in 13.4)
- EndpointNames type change (HashSet -> ISet)
- WithHiddenOnCompletion overload disambiguation
- [Experimental("ASPIREAZURE003")] on AzureRoleAssignmentResource
- 'sealed' on KubernetesHelmChartResource, BlazorWasmAppResource, BunAppResource (new in 13.4)
Package validation:
- Bumped PackageValidationBaselineVersion 13.2.2 -> 13.3.5
- Regenerated CompatibilitySuppressions.xml in 4 projects: most legacy
entries against 13.2.2 are no longer needed because those APIs already
shipped in 13.3.x. The remaining suppression is PublishAsNpmScript in
Aspire.Hosting.JavaScript (documented removal from PR #17382).
* API review fixes for 13.4 (PR #17700) Addresses several issues found during API surface review: 1. Rename NetworkID -> NetworkId (and networkID -> networkId) on AllocatedEndpoint, EndpointAnnotation, EndpointReference, EndpointReferenceAnnotation, NetworkEndpointSnapshot, NetworkEndpointSnapshotList, and related methods/parameters. 2. Add [Experimental("ASPIREAZURE003")] to AzureRoleAssignmentResource. 3. Change EndpointReferenceAnnotation.EndpointNames from HashSet<string> to ISet<string> (backing field stays HashSet). 4. Add 'sealed' to new public resource classes that are not subclassed in the repo: KubernetesHelmChartResource, BlazorWasmAppResource, BunAppResource, NextJsAppResource, ViteAppResource, AzureNatGatewayResource, AzureNetworkSecurityGroupResource, AzureNetworkSecurityPerimeterResource, AzurePrivateEndpointResource, AzurePublicIPAddressResource, AzureSubnetResource, AzureVirtualNetworkResource. (GoAppResource and NodeAppResource left non-sealed because they are used as generic type constraints in the same assembly.) 5. Disambiguate WithHiddenOnCompletion overloads by removing the '= 0' default from the int overload, so calls with no argument resolve to the params overload. api/*.cs and api/*.ats.txt are intentionally not updated here - the API surface PR will regenerate them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert breaking API changes; bump baseline to 13.3.5 Reverts the subset of API changes from the previous commit that would be binary-breaking against 13.3.5, and bumps PackageValidationBaselineVersion from 13.2.2 to 13.3.5 so pack validation runs against the latest shipped release. Reverts (binary-breaking against 13.3.5): - AllocatedEndpoint.NetworkID (kept ctor param 'networkId' - not breaking) - EndpointAnnotation.DefaultNetworkID (kept ctor param 'networkId') - EndpointReference.ContextNetworkID (kept ctor param 'contextNetworkId') - NetworkEndpointSnapshot.NetworkID record positional param - Removed 'sealed' from 9 shipped resource classes: - NextJsAppResource, ViteAppResource - AzureNatGatewayResource, AzureNetworkSecurityGroupResource, AzureNetworkSecurityPerimeterResource, AzurePrivateEndpointResource, AzurePublicIPAddressResource, AzureSubnetResource, AzureVirtualNetworkResource Kept (not binary-breaking): - All constructor/method parameter renames (networkID->networkId, etc.) - EndpointReferenceAnnotation.ContextNetworkId (new in 13.4) - EndpointNames type change (HashSet -> ISet) - WithHiddenOnCompletion overload disambiguation - [Experimental("ASPIREAZURE003")] on AzureRoleAssignmentResource - 'sealed' on KubernetesHelmChartResource, BlazorWasmAppResource, BunAppResource (new in 13.4) Package validation: - Bumped PackageValidationBaselineVersion 13.2.2 -> 13.3.5 - Regenerated CompatibilitySuppressions.xml in 4 projects: most legacy entries against 13.2.2 are no longer needed because those APIs already shipped in 13.3.x. The remaining suppression is PublishAsNpmScript in Aspire.Hosting.JavaScript (documented removal from PR #17382). --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replayed the 161 PRs merged to main between 2026-05-23 and 2026-06-06
through the audit selector. v1 (the prior file) resolved 89/161 PRs to
'selective' and dropped 26/161 to 'fallback_unmatched' (any unmatched
file forces RunAll). After this change all 161 PRs classify cleanly:
18 skip, 32 trigger_all, 111 selective, 0 fallback.
Additions:
* ignorePaths — files that never need a test gate but were forcing
fallback today: .vscode/**, .mcp.json, localhive.{sh,ps1},
.github/{extensions,policies,aw}/**, .agents/** (CLI agent skill
content, consumed only by humans/agents), eng/scripts/debug-*.{sh,ps1}
(developer-loop helpers), eng/scripts/cli-starter-validation*.ps1
(consumed by the always-on cli_starter_validation_windows job, which
isn't conditional-selector-gated).
* sourceToTestMappings — scripts and infra files that have a specific
test home but weren't wired up: eng/Publishing.props,
eng/Signing.props, eng/scripts/{pack,stage,verify,validate}-cli-*
and tools/TypeScriptApiCompat/** all map to Infrastructure.Tests
(its Pipelines/ and PowerShellScripts/ folders test these scripts).
eng/scripts/get-aspire-cli{,-pr}.{sh,ps1}, eng/scripts/verify-cli-archive.ps1,
eng/homebrew/** and eng/winget/** map to Aspire.Acquisition.Tests
(the script-suite that exercises them). eng/scripts/update-aspire-
skills-bundle.ps1 + verify-aspire-skills-bundle.ps1 map to
Aspire.Cli.Tests (AspireSkillsBundleTests). Two self-mappings for
tests directories without a 'tests/Aspire.*.Tests/**' shape:
tests/Infrastructure.Tests/** and
tests/Aspire.Hosting.CodeGeneration.TypeScript.JsTests/**.
* polyglot.triggerPaths — expanded beyond the workflow file itself to
cover the polyglot fixture tree (tests/PolyglotAppHosts/**) and the
per-language Aspire.Hosting.{JavaScript,TypeScript,Python,Go,Java,Rust}
+ CodeGeneration* projects. Without these, polyglot-impacting PRs
(#17545, #17499, #17419, #17400, #17382) all fell into RunAll.
Local verification: 251 TestSelector/PowerShellScripts/ConditionalSelection
tests still pass. The CI-trigger-pattern coverage test (which loads this
file from disk) is unchanged because we only added to ignorePaths and
sourceToTestMappings — no existing entries were removed or narrowed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Rename the JavaScript package-script publish API so it is not tied to npm when the implementation supports npm, pnpm, Yarn, and Bun package scripts.
The public API is now
PublishAsPackageScriptin C# andpublishAsPackageScriptin TypeScript, withscriptNamereplacingstartScriptNamefor the script option. The rename is propagated through C# and TypeScript call sites, playground docs, agent guidance, and Verify snapshot names. Generated API baseline files were not manually edited.User-facing usage
C# AppHost:
TypeScript AppHost:
Validation:
Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?