@@ -110,22 +110,23 @@ public static IResourceBuilder<NodeAppResource> AddPnpmApp(this IDistributedAppl
110110 /// </summary>
111111 /// <param name="resource">The Node.js app resource.</param>
112112 /// <param name="useCI">When true use <code>npm ci</code> otherwise use <code>npm install</code> when installing packages.</param>
113- /// <param name="args">Additional arguments to pass to the npm command .</param>
113+ /// <param name="configureInstaller">Configure the npm installer resource .</param>
114114 /// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
115- public static IResourceBuilder < NodeAppResource > WithNpmPackageInstallation ( this IResourceBuilder < NodeAppResource > resource , bool useCI = false , string [ ] ? args = null )
115+ public static IResourceBuilder < NodeAppResource > WithNpmPackageInstallation ( this IResourceBuilder < NodeAppResource > resource , bool useCI = false , Action < IResourceBuilder < NpmInstallerResource > > ? configureInstaller = null )
116116 {
117117 // Only install packages during development, not in publish mode
118118 if ( ! resource . ApplicationBuilder . ExecutionContext . IsPublishMode )
119119 {
120120 var installerName = $ "{ resource . Resource . Name } -npm-install";
121121 var installer = new NpmInstallerResource ( installerName , resource . Resource . WorkingDirectory ) ;
122122
123- args ??= [ ] ;
124123 var installerBuilder = resource . ApplicationBuilder . AddResource ( installer )
125- . WithArgs ( [ useCI ? "ci" : "install" , .. args ] )
124+ . WithArgs ( [ useCI ? "ci" : "install" ] )
126125 . WithParentRelationship ( resource . Resource )
127126 . ExcludeFromManifest ( ) ;
128127
128+ configureInstaller ? . Invoke ( installerBuilder ) ;
129+
129130 // Make the parent resource wait for the installer to complete
130131 resource . WaitForCompletion ( installerBuilder ) ;
131132 }
@@ -137,22 +138,23 @@ public static IResourceBuilder<NodeAppResource> WithNpmPackageInstallation(this
137138 /// Ensures the Node.js packages are installed before the application starts using yarn as the package manager.
138139 /// </summary>
139140 /// <param name="resource">The Node.js app resource.</param>
140- /// <param name="args">Additional arguments to pass to the yarn command .</param>
141+ /// <param name="configureInstaller">Configure the yarn installer resource .</param>
141142 /// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
142- public static IResourceBuilder < NodeAppResource > WithYarnPackageInstallation ( this IResourceBuilder < NodeAppResource > resource , string [ ] ? args = null )
143+ public static IResourceBuilder < NodeAppResource > WithYarnPackageInstallation ( this IResourceBuilder < NodeAppResource > resource , Action < IResourceBuilder < YarnInstallerResource > > ? configureInstaller = null )
143144 {
144145 // Only install packages during development, not in publish mode
145146 if ( ! resource . ApplicationBuilder . ExecutionContext . IsPublishMode )
146147 {
147148 var installerName = $ "{ resource . Resource . Name } -yarn-install";
148149 var installer = new YarnInstallerResource ( installerName , resource . Resource . WorkingDirectory ) ;
149150
150- args ??= [ ] ;
151151 var installerBuilder = resource . ApplicationBuilder . AddResource ( installer )
152- . WithArgs ( [ "install" , .. args ] )
152+ . WithArgs ( "install" )
153153 . WithParentRelationship ( resource . Resource )
154154 . ExcludeFromManifest ( ) ;
155155
156+ configureInstaller ? . Invoke ( installerBuilder ) ;
157+
156158 // Make the parent resource wait for the installer to complete
157159 resource . WaitForCompletion ( installerBuilder ) ;
158160 }
@@ -164,22 +166,23 @@ public static IResourceBuilder<NodeAppResource> WithYarnPackageInstallation(this
164166 /// Ensures the Node.js packages are installed before the application starts using pnpm as the package manager.
165167 /// </summary>
166168 /// <param name="resource">The Node.js app resource.</param>
167- /// <param name="args">Additional arguments to pass to the pnpm command .</param>
169+ /// <param name="configureInstaller">Configure the pnpm installer resource .</param>
168170 /// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
169- public static IResourceBuilder < NodeAppResource > WithPnpmPackageInstallation ( this IResourceBuilder < NodeAppResource > resource , string [ ] ? args = null )
171+ public static IResourceBuilder < NodeAppResource > WithPnpmPackageInstallation ( this IResourceBuilder < NodeAppResource > resource , Action < IResourceBuilder < PnpmInstallerResource > > ? configureInstaller = null )
170172 {
171173 // Only install packages during development, not in publish mode
172174 if ( ! resource . ApplicationBuilder . ExecutionContext . IsPublishMode )
173175 {
174176 var installerName = $ "{ resource . Resource . Name } -pnpm-install";
175177 var installer = new PnpmInstallerResource ( installerName , resource . Resource . WorkingDirectory ) ;
176178
177- args ??= [ ] ;
178179 var installerBuilder = resource . ApplicationBuilder . AddResource ( installer )
179- . WithArgs ( [ "install" , .. args ] )
180+ . WithArgs ( "install" )
180181 . WithParentRelationship ( resource . Resource )
181182 . ExcludeFromManifest ( ) ;
182183
184+ configureInstaller ? . Invoke ( installerBuilder ) ;
185+
183186 // Make the parent resource wait for the installer to complete
184187 resource . WaitForCompletion ( installerBuilder ) ;
185188 }
0 commit comments