Skip to content

🎥 Make videos programmatically with React

Update publish.ts

Jonny Burgerd45ba5dad80e
diff --git a/packages/it-tests/src/templates/publish.ts b/packages/it-tests/src/templates/publish.ts
index b93028e9c7..5ca041bc52 100644
--- a/packages/it-tests/src/templates/publish.ts
+++ b/packages/it-tests/src/templates/publish.ts
@@ -83,4 +83,27 @@ const publish = async (template: MinimalTemplate) => {
await $`git push origin ${defaultBranch.trim()}`.cwd(workingDir);
};
-await Promise.all(templates.map((template) => publish(template)));
+const CONCURRENCY = 4;
+
+const results: PromiseSettledResult<void>[] = [];
+
+for (let i = 0; i < templates.length; i += CONCURRENCY) {
+ const batch = templates.slice(i, i + CONCURRENCY);
+ const batchResults = await Promise.allSettled(
+ batch.map((template) => publish(template)),
+ );
+ results.push(...batchResults);
+}
+
+const failures = results.filter(
+ (r): r is PromiseRejectedResult => r.status === 'rejected',
+);
+
+if (failures.length > 0) {
+ console.error(`${failures.length} template(s) failed to publish:`);
+ for (const failure of failures) {
+ console.error(failure.reason);
+ }
+
+ process.exit(1);
+}