@dropthis/cli 0.6.1 → 0.7.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
@@ -754,13 +754,13 @@ async function runDoctor(_input, deps) {
754
754
  const authSource = credential?.source ?? "missing";
755
755
  const storageBackend = stored?.storage ?? "none";
756
756
  const pairs = [
757
- ["Version", "0.6.1"],
757
+ ["Version", "0.7.0"],
758
758
  ["Auth", authSource],
759
759
  ["Storage", storageBackend]
760
760
  ];
761
761
  writeKv(deps, pairs, {
762
762
  ok: true,
763
- version: "0.6.1",
763
+ version: "0.7.0",
764
764
  auth: { source: authSource },
765
765
  storage: { backend: storageBackend }
766
766
  });
@@ -1264,6 +1264,27 @@ async function handlePublishDryRun(input, raw, deps, client) {
1264
1264
  var prompts4 = __toESM(require("@clack/prompts"), 1);
1265
1265
  var NO_UPDATE_MESSAGE = "Nothing to update. Provide an input path or at least one update option.";
1266
1266
  var NO_UPDATE_NEXT_ACTION = "Run dropthis drops update --help, or retry with an input path (for example, dropthis drops update <dropId> ./dist) or one of: --title, --slug, --visibility, --password, --no-password, --noindex, --index, --expires-at, or --metadata.";
1267
+ var DEPLOY_REJECTS_SETTINGS = "A deployment changes content only \u2014 it can't change settings in the same call.";
1268
+ var DEPLOY_SETTINGS_NEXT_ACTION = "Deploy the new content first (dropthis drops update <dropId> ./dist), then change settings separately (dropthis drops update <dropId> --title ... --visibility ...). Settings on an existing drop never require re-uploading content.";
1269
+ var SETTINGS_KEYS = [
1270
+ "slug",
1271
+ "title",
1272
+ "visibility",
1273
+ "password",
1274
+ "noindex",
1275
+ "expiresAt",
1276
+ "metadata"
1277
+ ];
1278
+ function hasSettingsFields(options) {
1279
+ return SETTINGS_KEYS.some((key) => options[key] !== void 0);
1280
+ }
1281
+ function contentDeployOptions(options) {
1282
+ const out = {};
1283
+ if (options.entry !== void 0) out.entry = options.entry;
1284
+ if (options.contentType !== void 0) out.contentType = options.contentType;
1285
+ if (options.path !== void 0) out.path = options.path;
1286
+ return out;
1287
+ }
1267
1288
  async function runUpdate(target, input, raw, deps) {
1268
1289
  try {
1269
1290
  await requireCredential({
@@ -1297,12 +1318,23 @@ async function runUpdate(target, input, raw, deps) {
1297
1318
  );
1298
1319
  }
1299
1320
  }
1321
+ if (updateInput && hasSettingsFields(parsed)) {
1322
+ return writeError(
1323
+ deps,
1324
+ "invalid_usage",
1325
+ DEPLOY_REJECTS_SETTINGS,
1326
+ DEPLOY_SETTINGS_NEXT_ACTION
1327
+ );
1328
+ }
1300
1329
  const revisionOptions = raw.ifRevision !== void 0 ? { ifRevision: Number(raw.ifRevision) } : {};
1301
1330
  spin = shouldSpin(deps.outputMode) ? createSpinner("Updating\u2026", deps.stderr) : void 0;
1302
1331
  const result = updateInput ? await deps.client.deploy(
1303
1332
  target,
1304
1333
  updateInput,
1305
- withIdempotencyKey({ ...parsed, ...revisionOptions }, "upd")
1334
+ withIdempotencyKey(
1335
+ { ...contentDeployOptions(parsed), ...revisionOptions },
1336
+ "upd"
1337
+ )
1306
1338
  ) : await deps.client.update(
1307
1339
  target,
1308
1340
  withIdempotencyKey({ ...parsed, ...revisionOptions }, "upd")
@@ -1736,7 +1768,7 @@ function buildProgram(options = {}) {
1736
1768
  ` ${import_picocolors4.default.cyan("dropthis login")}`,
1737
1769
  ` ${import_picocolors4.default.cyan("dropthis publish ./dist")}`
1738
1770
  ].join("\n")
1739
- ).version("0.6.1").configureHelp({
1771
+ ).version("0.7.0").configureHelp({
1740
1772
  subcommandTerm(cmd) {
1741
1773
  const args = cmd.registeredArguments.map((a) => {
1742
1774
  const name = a.name();