-
Notifications
You must be signed in to change notification settings - Fork 911
Expand file tree
/
Copy pathJavaScriptPackageManagerAnnotation.cs
More file actions
60 lines (50 loc) · 2.68 KB
/
Copy pathJavaScriptPackageManagerAnnotation.cs
File metadata and controls
60 lines (50 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.ApplicationModel.Docker;
namespace Aspire.Hosting.JavaScript;
/// <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>
/// <param name="cacheMount">The BuildKit cache mount path for the package manager, or null if not supported.</param>
public sealed class JavaScriptPackageManagerAnnotation(string executableName, string? runScriptCommand, string? cacheMount = null) : 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;
/// <summary>
/// Gets the string used to separate individual commands in a command sequence, or <see langword="null"/> if one shouldn't be used.
/// Defaults to "--".
/// </summary>
public string? CommandSeparator { get; init; } = "--";
/// <summary>
/// Gets the BuildKit cache mount path for the package manager, or null if not supported.
/// </summary>
public string? CacheMount { get; } = cacheMount;
/// <summary>
/// Gets the file patterns for package dependency files.
/// </summary>
public List<CopyFilePattern> PackageFilesPatterns { get; } = [];
/// <summary>
/// Gets or sets a callback to initialize the Docker build stage before installing packages.
/// </summary>
[Experimental("ASPIREDOCKERFILEBUILDER001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public Action<DockerfileStage>? InitializeDockerBuildStage { get; init; }
/// <summary>
/// Gets or sets a callback to initialize the Docker runtime stage before configuring the entrypoint.
/// </summary>
[Experimental("ASPIREDOCKERFILEBUILDER001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
internal Action<DockerfileStage>? InitializeDockerRuntimeStage { get; init; }
/// <summary>
/// Gets or sets a callback to resolve the default <c>PublishAsNpmScript</c> runtime image from the build image.
/// </summary>
internal Func<string, string>? ResolveNpmScriptRuntimeImage { get; init; }
}