Commit 089b7ff
Refactor WithNpmPackageManager to WithNpm with install parameter (dotnet#12325)
## Refactor WithNpmPackageManager to WithNpm with install parameter
### Changes completed:
- [x] Update NodeExtensions.cs to rename `WithNpmPackageManager` to `WithNpm`
- [x] Change parameter name from `autoInstall` to `install` with default value `false`
- [x] Update XML documentation to reflect the new parameter name and default
- [x] Update example in XML documentation to use `.WithNpm(install: true)`
- [x] Update all test usages to explicitly use `install: true` when installer should be created
- [x] Update test for `install: false` behavior (renamed test)
- [x] Update playground examples to use `.WithNpm(install: true)`
- [x] Update template file in aspire-py-starter to use `.WithNpm(install: true)`
- [x] Add comprehensive unit tests for new public APIs:
- `WithYarn` - tests for both install=true and install=false
- `WithPnpm` - tests for both install=true and install=false
- `WithInstallCommand` - tests custom install command with custom args
- `WithBuildCommand` - tests custom build command
- Override scenarios for both install and build commands
- [x] Fix existing tests to match new installer naming convention (`{name}-installer` instead of `{name}-npm-install`)
- [x] Run tests to verify all changes work correctly (47 tests passed)
### Summary:
Successfully added comprehensive unit tests for all new public APIs introduced in the refactoring. The tests verify:
- Package manager annotations are correctly set for each package manager (npm, yarn, pnpm)
- Installer resources are created/not created based on the `install` parameter
- Custom install and build commands can be set using `WithInstallCommand` and `WithBuildCommand`
- Existing commands can be overridden
- All tests pass (47/47)
* Refactor WithNpmPackageManager to WithNpm with autoInstall parameter
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
* Apply feedback: Rename autoInstall to install with default false
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
* WIP - refactor JS
* First round of refactoring
* Refactor and add yarn, pnmp, and WithInstall/BuildCommand APIs
* Fix build
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add comprehensive unit tests for new public APIs (WithYarn, WithPnpm, WithInstallCommand, WithBuildCommand)
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
* Update AspireWithJavaScript playground app
* Add more tests
* Update comments.
* Apply suggestion from @eerhardt
* Respond to PR feedback
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 1f493e6 commit 089b7ff
File tree
13 files changed
+1292
-830
lines changed- playground/AspireWithJavaScript
- AspireJavaScript.AppHost
- AspireJavaScript.Vue
- src
- Aspire.Hosting.NodeJs
- Aspire.ProjectTemplates/templates/aspire-py-starter/13.0
- tests/Aspire.Hosting.NodeJs.Tests
13 files changed
+1292
-830
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
Lines changed: 716 additions & 596 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments