@wraps.dev/cli 2.10.1 → 2.10.2
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
|
@@ -19425,7 +19425,7 @@ async function templatesPush(options) {
|
|
|
19425
19425
|
}
|
|
19426
19426
|
await pushToSES(compiled, progress);
|
|
19427
19427
|
const token = await resolveTokenAsync({ token: options.token });
|
|
19428
|
-
const apiResults = await pushToAPI(compiled, token, config2.org, progress);
|
|
19428
|
+
const apiResults = await pushToAPI(compiled, token, config2.org, progress, options.force);
|
|
19429
19429
|
for (const t of compiled) {
|
|
19430
19430
|
const apiResult = apiResults.find((r) => r.slug === t.slug);
|
|
19431
19431
|
lockfile.templates[t.slug] = {
|
|
@@ -19664,7 +19664,7 @@ async function pushToSES(templates, progress) {
|
|
|
19664
19664
|
}
|
|
19665
19665
|
return results;
|
|
19666
19666
|
}
|
|
19667
|
-
async function pushToAPI(templates, token, _org, progress) {
|
|
19667
|
+
async function pushToAPI(templates, token, _org, progress, force) {
|
|
19668
19668
|
if (!token) {
|
|
19669
19669
|
progress.info(
|
|
19670
19670
|
"No API token \u2014 skipping dashboard sync. Run: wraps auth login"
|
|
@@ -19694,19 +19694,32 @@ async function pushToAPI(templates, token, _org, progress) {
|
|
|
19694
19694
|
variables: t.variables,
|
|
19695
19695
|
sourceHash: t.sourceHash,
|
|
19696
19696
|
sesTemplateName: t.sesTemplateName,
|
|
19697
|
-
cliProjectPath: t.cliProjectPath
|
|
19697
|
+
cliProjectPath: t.cliProjectPath,
|
|
19698
|
+
force: force ?? false
|
|
19698
19699
|
}))
|
|
19699
19700
|
})
|
|
19700
19701
|
});
|
|
19701
|
-
if (
|
|
19702
|
+
if (resp.status === 409) {
|
|
19703
|
+
const data = await resp.json();
|
|
19704
|
+
for (const c of data.conflicts ?? []) {
|
|
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
|
+
}
|
|
19710
|
+
for (const r of data.results ?? []) {
|
|
19711
|
+
results.push({ slug: r.slug, id: r.id, success: true });
|
|
19712
|
+
}
|
|
19713
|
+
} else if (!resp.ok) {
|
|
19702
19714
|
const body = await resp.text();
|
|
19703
19715
|
throw new Error(`API returned ${resp.status}: ${body}`);
|
|
19716
|
+
} else {
|
|
19717
|
+
const data = await resp.json();
|
|
19718
|
+
for (const r of data.results) {
|
|
19719
|
+
results.push({ slug: r.slug, id: r.id, success: true });
|
|
19720
|
+
}
|
|
19721
|
+
progress.succeed(`Synced ${templates.length} templates to dashboard`);
|
|
19704
19722
|
}
|
|
19705
|
-
const data = await resp.json();
|
|
19706
|
-
for (const r of data.results) {
|
|
19707
|
-
results.push({ slug: r.slug, id: r.id, success: true });
|
|
19708
|
-
}
|
|
19709
|
-
progress.succeed(`Synced ${templates.length} templates to dashboard`);
|
|
19710
19723
|
} catch (err) {
|
|
19711
19724
|
const msg = err instanceof Error ? err.message : String(err);
|
|
19712
19725
|
progress.fail(`Dashboard sync failed: ${msg}`);
|
|
@@ -19735,16 +19748,23 @@ async function pushToAPI(templates, token, _org, progress) {
|
|
|
19735
19748
|
variables: t.variables,
|
|
19736
19749
|
sourceHash: t.sourceHash,
|
|
19737
19750
|
sesTemplateName: t.sesTemplateName,
|
|
19738
|
-
cliProjectPath: t.cliProjectPath
|
|
19751
|
+
cliProjectPath: t.cliProjectPath,
|
|
19752
|
+
force: force ?? false
|
|
19739
19753
|
})
|
|
19740
19754
|
});
|
|
19741
|
-
if (
|
|
19755
|
+
if (resp.status === 409) {
|
|
19756
|
+
results.push({ slug: t.slug, success: false });
|
|
19757
|
+
progress.fail(
|
|
19758
|
+
`${pc26.cyan(t.slug)} was edited on the dashboard since your last push. Use ${pc26.bold("--force")} to overwrite.`
|
|
19759
|
+
);
|
|
19760
|
+
} else if (!resp.ok) {
|
|
19742
19761
|
const body = await resp.text();
|
|
19743
19762
|
throw new Error(`API returned ${resp.status}: ${body}`);
|
|
19763
|
+
} else {
|
|
19764
|
+
const data = await resp.json();
|
|
19765
|
+
results.push({ slug: data.slug, id: data.id, success: true });
|
|
19766
|
+
progress.succeed(`Synced ${pc26.cyan(t.slug)} to dashboard`);
|
|
19744
19767
|
}
|
|
19745
|
-
const data = await resp.json();
|
|
19746
|
-
results.push({ slug: data.slug, id: data.id, success: true });
|
|
19747
|
-
progress.succeed(`Synced ${pc26.cyan(t.slug)} to dashboard`);
|
|
19748
19768
|
} catch (err) {
|
|
19749
19769
|
const msg = err instanceof Error ? err.message : String(err);
|
|
19750
19770
|
results.push({ slug: t.slug, success: false });
|
|
@@ -19776,7 +19796,6 @@ async function findCliNodeModules() {
|
|
|
19776
19796
|
const paths = [];
|
|
19777
19797
|
try {
|
|
19778
19798
|
const { createRequire } = await import("module");
|
|
19779
|
-
const { fileURLToPath: fileURLToPath6 } = await import("url");
|
|
19780
19799
|
const { dirname: dirname4 } = await import("path");
|
|
19781
19800
|
for (const base of [
|
|
19782
19801
|
// The current file's location (works when running from source)
|