@wraps.dev/cli 2.17.9 → 2.17.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -5263,6 +5263,10 @@ var init_output = __esm({
5263
5263
  */
5264
5264
  start(message) {
5265
5265
  if (this.silent) return;
5266
+ if (this.currentSpinner) {
5267
+ this.currentSpinner.stop("");
5268
+ this.currentSpinner = null;
5269
+ }
5266
5270
  this.currentSpinner = clack8.spinner();
5267
5271
  this.currentSpinner.start(message);
5268
5272
  }
@@ -23494,47 +23498,66 @@ async function pushToSES(templates, progress) {
23494
23498
  UpdateTemplateCommand
23495
23499
  } = await import("@aws-sdk/client-ses");
23496
23500
  const ses = new SESClient6({ region });
23497
- const settled = await Promise.allSettled(
23498
- templates.map(async (t) => {
23499
- progress.start(`Pushing ${pc29.cyan(t.slug)} to SES`);
23500
- const templateData = {
23501
- TemplateName: t.sesTemplateName,
23502
- SubjectPart: t.subject,
23503
- HtmlPart: t.compiledHtml,
23504
- TextPart: t.compiledText
23505
- };
23506
- let exists = false;
23507
- try {
23508
- await ses.send(
23509
- new GetTemplateCommand({ TemplateName: t.sesTemplateName })
23510
- );
23511
- exists = true;
23512
- } catch (err) {
23513
- const e = err;
23514
- if (e.name !== "TemplateDoesNotExistException") {
23515
- throw err;
23501
+ try {
23502
+ progress.start(
23503
+ `Pushing ${templates.length} template${templates.length === 1 ? "" : "s"} to SES`
23504
+ );
23505
+ const settled = await Promise.allSettled(
23506
+ templates.map(async (t) => {
23507
+ const templateData = {
23508
+ TemplateName: t.sesTemplateName,
23509
+ SubjectPart: t.subject,
23510
+ HtmlPart: t.compiledHtml,
23511
+ TextPart: t.compiledText
23512
+ };
23513
+ let exists = false;
23514
+ try {
23515
+ await ses.send(
23516
+ new GetTemplateCommand({ TemplateName: t.sesTemplateName })
23517
+ );
23518
+ exists = true;
23519
+ } catch (err) {
23520
+ const e = err;
23521
+ if (e.name !== "TemplateDoesNotExistException") {
23522
+ throw err;
23523
+ }
23516
23524
  }
23517
- }
23518
- if (exists) {
23519
- await ses.send(new UpdateTemplateCommand({ Template: templateData }));
23525
+ if (exists) {
23526
+ await ses.send(new UpdateTemplateCommand({ Template: templateData }));
23527
+ } else {
23528
+ await ses.send(new CreateTemplateCommand({ Template: templateData }));
23529
+ }
23530
+ return { slug: t.slug };
23531
+ })
23532
+ );
23533
+ const failures = [];
23534
+ for (let i = 0; i < templates.length; i++) {
23535
+ const result = settled[i];
23536
+ if (result.status === "fulfilled") {
23537
+ results.push({ slug: result.value.slug, success: true });
23520
23538
  } else {
23521
- await ses.send(new CreateTemplateCommand({ Template: templateData }));
23539
+ const msg = result.reason instanceof Error ? result.reason.message : String(result.reason);
23540
+ results.push({ slug: templates[i].slug, success: false });
23541
+ failures.push(`${templates[i].slug}: ${msg}`);
23522
23542
  }
23523
- progress.succeed(`Pushed ${pc29.cyan(t.slug)} to SES`);
23524
- return { slug: t.slug };
23525
- })
23526
- );
23527
- for (let i = 0; i < templates.length; i++) {
23528
- const result = settled[i];
23529
- if (result.status === "fulfilled") {
23530
- results.push({ slug: result.value.slug, success: true });
23543
+ }
23544
+ const successCount = results.filter((r) => r.success).length;
23545
+ if (failures.length === 0) {
23546
+ progress.succeed(
23547
+ `Pushed ${successCount} template${successCount === 1 ? "" : "s"} to SES`
23548
+ );
23531
23549
  } else {
23532
- const msg = result.reason instanceof Error ? result.reason.message : String(result.reason);
23533
- results.push({ slug: templates[i].slug, success: false });
23534
- progress.fail(`SES push failed for ${templates[i].slug}: ${msg}`);
23550
+ progress.succeed(
23551
+ `Pushed ${successCount}/${templates.length} templates to SES`
23552
+ );
23553
+ for (const f of failures) {
23554
+ progress.fail(`SES push failed: ${f}`);
23555
+ }
23535
23556
  }
23557
+ return results;
23558
+ } finally {
23559
+ ses.destroy();
23536
23560
  }
23537
- return results;
23538
23561
  }
23539
23562
  async function fetchRemoteTemplateSlugs(token, progress) {
23540
23563
  if (!token) {
@@ -23633,8 +23656,9 @@ async function pushToAPI(templates, token, progress, force) {
23633
23656
  throw new Error(`API returned ${resp.status}: ${body}`);
23634
23657
  }
23635
23658
  } catch (err) {
23659
+ const cause = err instanceof Error && err.cause instanceof Error ? `: ${err.cause.message}` : "";
23636
23660
  const msg = err instanceof Error ? err.message : String(err);
23637
- progress.fail(`Dashboard sync failed: ${msg}`);
23661
+ progress.fail(`Dashboard sync failed: ${msg}${cause}`);
23638
23662
  for (const t of templates) {
23639
23663
  results.push({ slug: t.slug, success: false });
23640
23664
  }
@@ -23678,9 +23702,10 @@ async function pushToAPI(templates, token, progress, force) {
23678
23702
  throw new Error(`API returned ${resp.status}: ${body}`);
23679
23703
  }
23680
23704
  } catch (err) {
23705
+ const cause = err instanceof Error && err.cause instanceof Error ? `: ${err.cause.message}` : "";
23681
23706
  const msg = err instanceof Error ? err.message : String(err);
23682
23707
  results.push({ slug: t.slug, success: false });
23683
- progress.fail(`Dashboard sync failed for ${t.slug}: ${msg}`);
23708
+ progress.fail(`Dashboard sync failed for ${t.slug}: ${msg}${cause}`);
23684
23709
  }
23685
23710
  }
23686
23711
  return results;