Skip to content

Commit 89f661e

Browse files
committed
Fixing the wait on installer for monorepos
1 parent 907dbae commit 89f661e

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

src/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions/NodeJSHostingExtensions.PackageInstallers.cs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ public static IResourceBuilder<NodeAppResource> WithNpmPackageInstallation(this
2626
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
2727
.WithArgs([useCI ? "ci" : "install"])
2828
.WithParentRelationship(resource.Resource)
29-
.ExcludeFromManifest()
30-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
29+
.ExcludeFromManifest();
3130

3231
// Make the parent resource wait for the installer to complete
3332
resource.WaitForCompletion(installerBuilder);
3433

3534
configureInstaller?.Invoke(installerBuilder);
35+
36+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
3637
}
3738

3839
return resource;
@@ -55,13 +56,14 @@ public static IResourceBuilder<NodeAppResource> WithYarnPackageInstallation(this
5556
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
5657
.WithArgs("install")
5758
.WithParentRelationship(resource.Resource)
58-
.ExcludeFromManifest()
59-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
59+
.ExcludeFromManifest();
6060

6161
// Make the parent resource wait for the installer to complete
6262
resource.WaitForCompletion(installerBuilder);
6363

6464
configureInstaller?.Invoke(installerBuilder);
65+
66+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
6567
}
6668

6769
return resource;
@@ -84,13 +86,14 @@ public static IResourceBuilder<NodeAppResource> WithPnpmPackageInstallation(this
8486
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
8587
.WithArgs("install")
8688
.WithParentRelationship(resource.Resource)
87-
.ExcludeFromManifest()
88-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
89+
.ExcludeFromManifest();
8990

9091
// Make the parent resource wait for the installer to complete
9192
resource.WaitForCompletion(installerBuilder);
9293

9394
configureInstaller?.Invoke(installerBuilder);
95+
96+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
9497
}
9598

9699
return resource;
@@ -114,10 +117,11 @@ public static IResourceBuilder<NxResource> WithNpmPackageInstaller(this IResourc
114117
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
115118
.WithArgs([useCI ? "ci" : "install"])
116119
.WithParentRelationship(resource.Resource)
117-
.ExcludeFromManifest()
118-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
120+
.ExcludeFromManifest();
119121

120122
configureInstaller?.Invoke(installerBuilder);
123+
124+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
121125
}
122126

123127
return resource;
@@ -140,10 +144,11 @@ public static IResourceBuilder<NxResource> WithYarnPackageInstaller(this IResour
140144
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
141145
.WithArgs("install")
142146
.WithParentRelationship(resource.Resource)
143-
.ExcludeFromManifest()
144-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
147+
.ExcludeFromManifest();
145148

146149
configureInstaller?.Invoke(installerBuilder);
150+
151+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
147152
}
148153

149154
return resource;
@@ -166,10 +171,11 @@ public static IResourceBuilder<NxResource> WithPnpmPackageInstaller(this IResour
166171
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
167172
.WithArgs("install")
168173
.WithParentRelationship(resource.Resource)
169-
.ExcludeFromManifest()
170-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
174+
.ExcludeFromManifest();
171175

172176
configureInstaller?.Invoke(installerBuilder);
177+
178+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
173179
}
174180

175181
return resource;
@@ -193,10 +199,11 @@ public static IResourceBuilder<TurborepoResource> WithNpmPackageInstaller(this I
193199
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
194200
.WithArgs([useCI ? "ci" : "install"])
195201
.WithParentRelationship(resource.Resource)
196-
.ExcludeFromManifest()
197-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
202+
.ExcludeFromManifest();
198203

199204
configureInstaller?.Invoke(installerBuilder);
205+
206+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
200207
}
201208

202209
return resource;
@@ -219,10 +226,11 @@ public static IResourceBuilder<TurborepoResource> WithYarnPackageInstaller(this
219226
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
220227
.WithArgs("install")
221228
.WithParentRelationship(resource.Resource)
222-
.ExcludeFromManifest()
223-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
229+
.ExcludeFromManifest();
224230

225231
configureInstaller?.Invoke(installerBuilder);
232+
233+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
226234
}
227235

228236
return resource;
@@ -245,10 +253,11 @@ public static IResourceBuilder<TurborepoResource> WithPnpmPackageInstaller(this
245253
var installerBuilder = resource.ApplicationBuilder.AddResource(installer)
246254
.WithArgs("install")
247255
.WithParentRelationship(resource.Resource)
248-
.ExcludeFromManifest()
249-
.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
256+
.ExcludeFromManifest();
250257

251258
configureInstaller?.Invoke(installerBuilder);
259+
260+
resource.WithAnnotation(new JavaScriptPackageInstallerAnnotation(installer));
252261
}
253262

254263
return resource;

src/CommunityToolkit.Aspire.Hosting.NodeJS.Extensions/NodeJSHostingExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static IResourceBuilder<TurborepoAppResource> AddApp(this IResourceBuilde
189189

190190
if (builder.Resource.TryGetLastAnnotation<JavaScriptPackageInstallerAnnotation>(out var installerAnnotation))
191191
{
192-
rb.WaitFor(builder.ApplicationBuilder.CreateResourceBuilder(installerAnnotation.Resource));
192+
rb.WaitForCompletion(builder.ApplicationBuilder.CreateResourceBuilder(installerAnnotation.Resource));
193193
}
194194

195195
configure?.Invoke(rb);

0 commit comments

Comments
 (0)