-
Notifications
You must be signed in to change notification settings - Fork 763
Refactor NodeJs Integration #12530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+674
−336
Merged
Refactor NodeJs Integration #12530
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0b7bda6
Refactor JavaScript Integration
eerhardt 615c10b
Default install command args in publish mode.
eerhardt a724921
Only use clean installs when the lock file exists in publish mode.
eerhardt c5a2ea4
Address copilot feedback
eerhardt 427d88e
More PR feedback
eerhardt 176ca5f
Fix PublishAsDockerFile to always clear the args when it is called, e…
eerhardt de7e5e0
Update npm install command comment in AppHost.cs
davidfowl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Refactor JavaScript Integration
- Obsolete AddNpmApp. - Add JavaScriptAppResource and AddJavaScriptApp extension method - Refactor AddViteApp to be a specialization of AddJavaScriptApp - Replace NodeInstallerResource with JavaScriptInstallerResource - Add JavaScriptPackageManagerAnnotation to handle different package managers - Replace JavaScriptRunCommandAnnotation with JavaScriptRunScriptAnnotation - Replace JavaScriptBuildCommandAnnotation with JavaScriptBuildScriptAnnotation Contributes to #8350
- Loading branch information
commit 0b7bda6bccbe2c0eb7e4a86543ae6a85c64ffd9b
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Aspire.Hosting.ApplicationModel; | ||
|
|
||
| namespace Aspire.Hosting; | ||
|
|
||
| /// <summary> | ||
| /// A resource that represents a JavaScript application. | ||
| /// </summary> | ||
| /// <param name="name">The name of the resource.</param> | ||
| /// <param name="command">The command to execute.</param> | ||
| /// <param name="workingDirectory">The working directory to use for the command. If null, the working directory of the current process is used.</param> | ||
| public class JavaScriptAppResource(string name, string command, string workingDirectory) | ||
| : ExecutableResource(name, command, workingDirectory), IResourceWithServiceDiscovery, IResourceWithContainerFiles; |
24 changes: 0 additions & 24 deletions
24
src/Aspire.Hosting.NodeJs/JavaScriptBuildCommandAnnotation.cs
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
src/Aspire.Hosting.NodeJs/JavaScriptBuildScriptAnnotation.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Aspire.Hosting.ApplicationModel; | ||
|
|
||
| namespace Aspire.Hosting.NodeJs; | ||
|
|
||
| /// <summary> | ||
| /// Represents the annotation for the JavaScript package manager's build script. | ||
| /// </summary> | ||
| /// <param name="scriptName">The name of the JavaScript package manager's build script.</param> | ||
| /// <param name="args">The command line arguments for the JavaScript package manager's build script.</param> | ||
| public sealed class JavaScriptBuildScriptAnnotation(string scriptName, string[]? args) : IResourceAnnotation | ||
| { | ||
| /// <summary> | ||
| /// Gets the name of the script used to build. | ||
| /// </summary> | ||
| public string ScriptName { get; } = scriptName; | ||
|
|
||
| /// <summary> | ||
| /// Gets the command-line arguments supplied to the build script. | ||
| /// </summary> | ||
| public string[] Args { get; } = args ?? []; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/Aspire.Hosting.NodeJs/JavaScriptPackageManagerAnnotation.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Aspire.Hosting.ApplicationModel; | ||
|
|
||
| namespace Aspire.Hosting.NodeJs; | ||
|
|
||
| /// <summary> | ||
| /// Represents the annotation for the JavaScript package manager used in a resource. | ||
| /// </summary> | ||
| /// <param name="executableName">The name of the executable used to run the package manager.</param> | ||
| /// <param name="runScriptCommand">The command used to run a script with the JavaScript package manager.</param> | ||
| public sealed class JavaScriptPackageManagerAnnotation(string executableName, string? runScriptCommand) : IResourceAnnotation | ||
| { | ||
| /// <summary> | ||
| /// Gets the executable used to run the JavaScript package manager. | ||
| /// </summary> | ||
| public string ExecutableName { get; } = executableName; | ||
|
|
||
| /// <summary> | ||
| /// Gets the command used to run a script with the JavaScript package manager. | ||
| /// </summary> | ||
| public string? ScriptCommand { get; } = runScriptCommand; | ||
| } |
21 changes: 0 additions & 21 deletions
21
src/Aspire.Hosting.NodeJs/JavaScriptRunCommandAnnotation.cs
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
src/Aspire.Hosting.NodeJs/JavaScriptRunScriptAnnotation.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Aspire.Hosting.ApplicationModel; | ||
|
|
||
| namespace Aspire.Hosting.NodeJs; | ||
|
|
||
| /// <summary> | ||
| /// Represents the annotation for the script used during run mode in a JavaScript resource. | ||
| /// </summary> | ||
| /// <param name="scriptName">The name of the JavaScript package manager's run script.</param> | ||
| /// <param name="args">The command line arguments for the JavaScript package manager's run script.</param> | ||
| public sealed class JavaScriptRunScriptAnnotation(string scriptName, string[]? args) : IResourceAnnotation | ||
| { | ||
| /// <summary> | ||
| /// Gets the name of the script to run. | ||
| /// </summary> | ||
| public string ScriptName { get; } = scriptName; | ||
|
|
||
| /// <summary> | ||
| /// Gets the name of the script to run. | ||
eerhardt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| public string[] Args { get; } = args ?? []; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.