@dropthis/cli 0.18.0 → 0.20.0

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.cjs CHANGED
@@ -916,13 +916,13 @@ async function runDoctor(_input, deps) {
916
916
  const authSource = credential?.source ?? "missing";
917
917
  const storageBackend = stored?.storage ?? "none";
918
918
  const pairs = [
919
- ["Version", "0.18.0"],
919
+ ["Version", "0.20.0"],
920
920
  ["Auth", authSource],
921
921
  ["Storage", storageBackend]
922
922
  ];
923
923
  writeKv(deps, pairs, {
924
924
  ok: true,
925
- version: "0.18.0",
925
+ version: "0.20.0",
926
926
  auth: { source: authSource },
927
927
  storage: { backend: storageBackend }
928
928
  });
@@ -997,6 +997,14 @@ function printNextHints(deps, hints, hostname, dns) {
997
997
  `);
998
998
  }
999
999
  }
1000
+ function printConsoleHandoff(deps, domain) {
1001
+ if (domain.status === "live" || !domain.consoleUrl) return;
1002
+ deps.stdout(
1003
+ `
1004
+ ${hint(`Or finish it in the console: ${domain.consoleUrl}`)}
1005
+ `
1006
+ );
1007
+ }
1000
1008
  function computeSleepMs(records, elapsedMs, timeoutMs) {
1001
1009
  const maxRetryAfter = records.reduce(
1002
1010
  (max, r) => Math.max(max, r.retryAfter ?? 0),
@@ -1031,6 +1039,7 @@ async function runDomainsConnect(input, deps) {
1031
1039
  `);
1032
1040
  }
1033
1041
  printNextHints(deps, domain.next, domain.hostname, domain.dns);
1042
+ printConsoleHandoff(deps, domain);
1034
1043
  } else {
1035
1044
  writeJson(deps, { ok: true, domain });
1036
1045
  }
@@ -1111,6 +1120,7 @@ async function runDomainsStatus(idOrHostname, _input, deps) {
1111
1120
  `);
1112
1121
  }
1113
1122
  printNextHints(deps, domain.next, domain.hostname, domain.dns);
1123
+ printConsoleHandoff(deps, domain);
1114
1124
  } else {
1115
1125
  writeJson(deps, { ok: true, domain });
1116
1126
  }
@@ -1144,6 +1154,7 @@ async function runDomainsVerify(idOrHostname, input, deps, sleep = defaultSleep)
1144
1154
  `);
1145
1155
  }
1146
1156
  printNextHints(deps, domain.next, domain.hostname, domain.dns);
1157
+ printConsoleHandoff(deps, domain);
1147
1158
  } else {
1148
1159
  writeJson(deps, { ok: true, domain });
1149
1160
  }
@@ -1656,6 +1667,7 @@ function formatDryRunManifest(prepared, extra) {
1656
1667
 
1657
1668
  // src/options.ts
1658
1669
  var import_promises = require("fs/promises");
1670
+ var import_node = require("@dropthis/node");
1659
1671
  async function parseDropOptions(raw) {
1660
1672
  if (raw.metadata && raw.metadataFile) {
1661
1673
  throw new Error("Use either --metadata or --metadata-file, not both.");
@@ -1666,6 +1678,9 @@ async function parseDropOptions(raw) {
1666
1678
  if (raw.noindex && raw.index) {
1667
1679
  throw new Error("Use either --noindex or --index, not both.");
1668
1680
  }
1681
+ if (raw.shared && raw.domain) {
1682
+ throw new Error("Use either --shared or --domain <hostname>, not both.");
1683
+ }
1669
1684
  if (raw.visibility && raw.visibility !== "public" && raw.visibility !== "unlisted") {
1670
1685
  throw new Error(
1671
1686
  `Invalid visibility "${raw.visibility}". Use "public" or "unlisted".`
@@ -1696,7 +1711,7 @@ async function parseDropOptions(raw) {
1696
1711
  ...raw.contentType ? { contentType: raw.contentType } : {},
1697
1712
  ...raw.path ? { path: raw.path } : {},
1698
1713
  ...raw.idempotencyKey ? { idempotencyKey: raw.idempotencyKey } : {},
1699
- ...raw.domain ? { domain: raw.domain } : {},
1714
+ ...raw.shared ? { domain: import_node.SHARED_POOL } : raw.domain ? { domain: raw.domain } : {},
1700
1715
  ...raw.slug ? { slug: raw.slug } : {}
1701
1716
  };
1702
1717
  }
@@ -2437,7 +2452,7 @@ async function runWhoami(_input, deps) {
2437
2452
  }
2438
2453
 
2439
2454
  // src/context.ts
2440
- var import_node = require("@dropthis/node");
2455
+ var import_node2 = require("@dropthis/node");
2441
2456
  function createContext(input) {
2442
2457
  const env = input.env ?? process.env;
2443
2458
  const global = input.global ?? {};
@@ -2454,7 +2469,7 @@ function createContext(input) {
2454
2469
  stderr: input.stderr ?? ((value) => process.stderr.write(value)),
2455
2470
  createClient(apiKey) {
2456
2471
  const baseUrl = global.apiUrl ?? env.DROPTHIS_API_URL;
2457
- return new import_node.Dropthis({
2472
+ return new import_node2.Dropthis({
2458
2473
  ...apiKey ? { apiKey } : {},
2459
2474
  ...baseUrl ? { baseUrl } : {}
2460
2475
  });
@@ -2644,7 +2659,7 @@ function buildProgram(options = {}) {
2644
2659
  ` ${import_picocolors6.default.cyan("dropthis login")}`,
2645
2660
  ` ${import_picocolors6.default.cyan("dropthis publish ./dist")}`
2646
2661
  ].join("\n")
2647
- ).version("0.18.0").configureHelp({
2662
+ ).version("0.20.0").configureHelp({
2648
2663
  subcommandTerm(cmd) {
2649
2664
  const args = cmd.registeredArguments.map((a) => {
2650
2665
  const name = a.name();
@@ -2688,7 +2703,10 @@ ${lines.map((l) => ` ${l}`).join("\n")}
2688
2703
  `Attach JSON key-value pairs, e.g. '{"source":"ci"}'`
2689
2704
  ).option("--metadata-file <path>", "Read metadata JSON from a file").option("--path <name>", "Set filename when publishing from stdin").option(
2690
2705
  "--domain <hostname>",
2691
- "Serve this drop under a connected custom domain (must be live \u2014 see: dropthis domains list), or pass the literal 'shared' to publish to the shared pool even when the account has a default domain. Path-mode: drop lives at https://domain/{slug}/. Dedicated: drop is at the root (409 if occupied). Omit to use the account's default path domain."
2706
+ "Serve this drop under a connected custom domain (must be live \u2014 see: dropthis domains list). Path-mode: drop lives at https://domain/{slug}/. Dedicated: drop is at the root (409 if occupied). Omit to use the account's default path domain. To publish to the shared pool instead, use --shared."
2707
+ ).option(
2708
+ "--shared",
2709
+ "Deliberately publish to the shared dropthis pool, bypassing your default custom domain (an off-domain publish). Cannot combine with --domain."
2692
2710
  ).option(
2693
2711
  "--slug <vanity-slug>",
2694
2712
  "Vanity slug for path-mode custom domains (1\u201363 lowercase letters/digits/hyphens). Auto-suffixed if taken. Only valid with --domain on a path-mode domain."
@@ -2705,7 +2723,7 @@ ${lines.map((l) => ` ${l}`).join("\n")}
2705
2723
  "dropthis publish ./dist --title 'Launch page'",
2706
2724
  "cat report.md | dropthis publish - --content-type text/markdown --path report.md",
2707
2725
  "dropthis publish ./dist --domain reports.example.com --slug launch",
2708
- "dropthis publish ./report.html --domain shared # bypass the account default domain",
2726
+ "dropthis publish ./report.html --shared # bypass your default domain \u2192 shared pool",
2709
2727
  "URL=$(dropthis publish ./dist --url)"
2710
2728
  ])
2711
2729
  ).addHelpText(
@@ -3214,7 +3232,7 @@ ${import_picocolors6.default.bold("Canonical vs raw URLs:")}`,
3214
3232
  );
3215
3233
  const result = await runUpgrade(commandOptions, {
3216
3234
  ...deps,
3217
- currentVersion: "0.18.0"
3235
+ currentVersion: "0.20.0"
3218
3236
  });
3219
3237
  process.exitCode = result.exitCode;
3220
3238
  });
@@ -3322,6 +3340,7 @@ function toDropOptions(options) {
3322
3340
  ...options.path ? { path: options.path } : {},
3323
3341
  ...options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {},
3324
3342
  ...options.domain ? { domain: options.domain } : {},
3343
+ ...options.shared ? { shared: true } : {},
3325
3344
  ...options.slug ? { slug: options.slug } : {},
3326
3345
  ...options.json !== void 0 ? { json: options.json } : {},
3327
3346
  ...options.quiet !== void 0 ? { quiet: options.quiet } : {},
@@ -3457,7 +3476,7 @@ var showNotice = shouldShowNotice({
3457
3476
  if (showNotice) {
3458
3477
  const notice = noticeFromCache({
3459
3478
  cache: updateCache,
3460
- currentVersion: "0.18.0"
3479
+ currentVersion: "0.20.0"
3461
3480
  });
3462
3481
  if (notice) {
3463
3482
  process.stderr.write(`