@wraps.dev/cli 2.10.2 → 2.10.4

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
@@ -19348,7 +19348,7 @@ async function templatesPush(options) {
19348
19348
  const filePath = join9(templatesDir, file);
19349
19349
  const source = await readFile4(filePath, "utf-8");
19350
19350
  const sourceHash = sha256(source);
19351
- if (!options.force && lockfile.templates[slug]?.localHash === sourceHash) {
19351
+ if (lockfile.templates[slug]?.localHash === sourceHash) {
19352
19352
  unchanged.push(slug);
19353
19353
  continue;
19354
19354
  }
@@ -19699,17 +19699,30 @@ async function pushToAPI(templates, token, _org, progress, force) {
19699
19699
  }))
19700
19700
  })
19701
19701
  });
19702
- if (resp.status === 409) {
19702
+ if (Number(resp.status) === 409) {
19703
19703
  const data = await resp.json();
19704
19704
  for (const c of data.conflicts ?? []) {
19705
19705
  results.push({ slug: c.slug, success: false });
19706
- progress.fail(
19707
- `${pc26.cyan(c.slug)} was edited on the dashboard. Use ${pc26.bold("--force")} to overwrite.`
19708
- );
19709
19706
  }
19710
19707
  for (const r of data.results ?? []) {
19711
19708
  results.push({ slug: r.slug, id: r.id, success: true });
19712
19709
  }
19710
+ const successCount = data.results?.length ?? 0;
19711
+ const conflictCount = data.conflicts?.length ?? 0;
19712
+ if (successCount > 0 && conflictCount > 0) {
19713
+ progress.succeed(`Synced ${successCount} templates to dashboard`);
19714
+ for (const c of data.conflicts ?? []) {
19715
+ progress.fail(
19716
+ `${pc26.cyan(c.slug)} was edited on the dashboard. Use ${pc26.bold("--force")} to overwrite.`
19717
+ );
19718
+ }
19719
+ } else if (conflictCount > 0) {
19720
+ for (const c of data.conflicts ?? []) {
19721
+ progress.fail(
19722
+ `${pc26.cyan(c.slug)} was edited on the dashboard. Use ${pc26.bold("--force")} to overwrite.`
19723
+ );
19724
+ }
19725
+ }
19713
19726
  } else if (!resp.ok) {
19714
19727
  const body = await resp.text();
19715
19728
  throw new Error(`API returned ${resp.status}: ${body}`);
@@ -19752,7 +19765,7 @@ async function pushToAPI(templates, token, _org, progress, force) {
19752
19765
  force: force ?? false
19753
19766
  })
19754
19767
  });
19755
- if (resp.status === 409) {
19768
+ if (Number(resp.status) === 409) {
19756
19769
  results.push({ slug: t.slug, success: false });
19757
19770
  progress.fail(
19758
19771
  `${pc26.cyan(t.slug)} was edited on the dashboard since your last push. Use ${pc26.bold("--force")} to overwrite.`