@liiift-studio/deploy-vercel-from-sanity 1.5.0 → 1.5.1

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/README.md CHANGED
@@ -336,8 +336,11 @@ Requirements for the route:
336
336
  your site's domain, so every call is cross-origin and the preflight fails
337
337
  without an allow-list. Echo one allow-listed origin; do not send `*` to an
338
338
  endpoint that takes an `Authorization` header.
339
- - **Restrict which branches it will bump.** The recovery flow only ever needs the
340
- branches you deploy.
339
+ - **Restrict which branches it will bump**, and read that list from the
340
+ environment rather than hard-coding it. The recovery flow only ever needs the
341
+ branches you deploy, but the list has to change when you add a deploy target —
342
+ and a hard-coded list can only be changed by shipping a deploy, which is the
343
+ very thing that is broken when this route is needed.
341
344
  - **Answer `{ error }` on failure.** The plugin shows that string to the editor
342
345
  verbatim, in preference to its own generic message.
343
346
  - **Serve it over https.** The plugin refuses a plaintext endpoint, because the
package/dist/index.js CHANGED
@@ -1054,6 +1054,7 @@ var import_jsx_runtime10 = require("react/jsx-runtime");
1054
1054
  var POLL_INTERVAL_MS = 5e3;
1055
1055
  var LABEL_WIDTH = 64;
1056
1056
  var PENDING_TIMEOUT_MS = 6e4;
1057
+ var BUMP_WATCH_TIMEOUT_MS = 3e5;
1057
1058
  function DeployItem({ target, token, onDelete, onEdit }) {
1058
1059
  const { projectId, hookId } = parseHookUrl(target.url);
1059
1060
  const toast = useToast();
@@ -1083,8 +1084,10 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1083
1084
  const [logError, setLogError] = (0, import_react8.useState)(null);
1084
1085
  const [pollError, setPollError] = (0, import_react8.useState)(null);
1085
1086
  const [bumping, setBumping] = (0, import_react8.useState)(false);
1087
+ const [awaitingBump, setAwaitingBump] = (0, import_react8.useState)(false);
1086
1088
  const [bumpResult, setBumpResult] = (0, import_react8.useState)(null);
1087
1089
  const triggeredFromUidRef = (0, import_react8.useRef)(void 0);
1090
+ const bumpedFromUidRef = (0, import_react8.useRef)(void 0);
1088
1091
  const requestSeqRef = (0, import_react8.useRef)(0);
1089
1092
  const mountedRef = (0, import_react8.useRef)(true);
1090
1093
  (0, import_react8.useEffect)(() => {
@@ -1115,10 +1118,19 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1115
1118
  fetchDeployments2().finally(() => setLoadingInitial(false));
1116
1119
  }, [fetchDeployments2]);
1117
1120
  (0, import_react8.useEffect)(() => {
1118
- if (!isActive) return;
1121
+ if (!isActive && !awaitingBump) return;
1119
1122
  const id = setInterval(fetchDeployments2, POLL_INTERVAL_MS);
1120
1123
  return () => clearInterval(id);
1121
- }, [isActive, fetchDeployments2]);
1124
+ }, [isActive, awaitingBump, fetchDeployments2]);
1125
+ (0, import_react8.useEffect)(() => {
1126
+ if (!awaitingBump) return;
1127
+ if (latest?.uid && latest.uid !== bumpedFromUidRef.current) setAwaitingBump(false);
1128
+ }, [awaitingBump, latest?.uid]);
1129
+ (0, import_react8.useEffect)(() => {
1130
+ if (!awaitingBump) return;
1131
+ const id = setTimeout(() => setAwaitingBump(false), BUMP_WATCH_TIMEOUT_MS);
1132
+ return () => clearTimeout(id);
1133
+ }, [awaitingBump]);
1122
1134
  (0, import_react8.useEffect)(() => {
1123
1135
  if (!isPending) return;
1124
1136
  if (latest?.uid && latest.uid !== triggeredFromUidRef.current) setPendingSince(null);
@@ -1248,6 +1260,8 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1248
1260
  // failure. Unused by workflow-dispatch mode.
1249
1261
  studioToken: client.config().token
1250
1262
  });
1263
+ bumpedFromUidRef.current = latest?.uid;
1264
+ setAwaitingBump(true);
1251
1265
  setBumpResult({
1252
1266
  ok: true,
1253
1267
  message: `Version bump requested on ${ref}. The new deploy appears here in a minute or two.`
@@ -1264,7 +1278,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1264
1278
  } finally {
1265
1279
  setBumping(false);
1266
1280
  }
1267
- }, [pluginConfig.unblock, latest?.meta?.githubCommitRef, currentUser, target.name, toast, client]);
1281
+ }, [pluginConfig.unblock, latest?.meta?.githubCommitRef, latest?.uid, currentUser, target.name, toast, client]);
1268
1282
  const branch = latest?.meta?.githubCommitRef;
1269
1283
  const commitMsg = latest?.meta?.githubCommitMessage?.split("\n")[0];
1270
1284
  const sha = shortSha(latest?.meta?.githubCommitSha);
@@ -1478,9 +1492,12 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1478
1492
  ", which Vercel will build."
1479
1493
  ] })
1480
1494
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { size: 0, muted: true, children: pluginConfig.unblock ? "This deployment carries no branch information, so a version bump cannot be targeted. Ask a developer to deploy manually." : "Ask a developer to push a version bump \u2014 a commit by an authorised author is needed before this site can deploy." }),
1481
- bumpResult && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { size: 0, weight: bumpResult.ok ? "semibold" : void 0, children: [
1482
- bumpResult.ok ? "\u2713 " : "",
1483
- bumpResult.message
1495
+ bumpResult && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Flex, { align: "center", gap: 2, children: [
1496
+ awaitingBump && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, { muted: true }),
1497
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text, { size: 0, weight: bumpResult.ok ? "semibold" : void 0, children: [
1498
+ bumpResult.ok && !awaitingBump ? "\u2713 " : "",
1499
+ bumpResult.message
1500
+ ] })
1484
1501
  ] })
1485
1502
  ] }) })
1486
1503
  ] }),
@@ -1870,7 +1887,7 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
1870
1887
  }
1871
1888
 
1872
1889
  // src/version.ts
1873
- var VERSION = "1.5.0";
1890
+ var VERSION = "1.5.1";
1874
1891
 
1875
1892
  // src/components/DeployTool.tsx
1876
1893
  var import_jsx_runtime13 = require("react/jsx-runtime");
package/dist/index.mjs CHANGED
@@ -1019,6 +1019,7 @@ import { Fragment, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1019
1019
  var POLL_INTERVAL_MS = 5e3;
1020
1020
  var LABEL_WIDTH = 64;
1021
1021
  var PENDING_TIMEOUT_MS = 6e4;
1022
+ var BUMP_WATCH_TIMEOUT_MS = 3e5;
1022
1023
  function DeployItem({ target, token, onDelete, onEdit }) {
1023
1024
  const { projectId, hookId } = parseHookUrl(target.url);
1024
1025
  const toast = useToast();
@@ -1048,8 +1049,10 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1048
1049
  const [logError, setLogError] = useState5(null);
1049
1050
  const [pollError, setPollError] = useState5(null);
1050
1051
  const [bumping, setBumping] = useState5(false);
1052
+ const [awaitingBump, setAwaitingBump] = useState5(false);
1051
1053
  const [bumpResult, setBumpResult] = useState5(null);
1052
1054
  const triggeredFromUidRef = useRef2(void 0);
1055
+ const bumpedFromUidRef = useRef2(void 0);
1053
1056
  const requestSeqRef = useRef2(0);
1054
1057
  const mountedRef = useRef2(true);
1055
1058
  useEffect4(() => {
@@ -1080,10 +1083,19 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1080
1083
  fetchDeployments2().finally(() => setLoadingInitial(false));
1081
1084
  }, [fetchDeployments2]);
1082
1085
  useEffect4(() => {
1083
- if (!isActive) return;
1086
+ if (!isActive && !awaitingBump) return;
1084
1087
  const id = setInterval(fetchDeployments2, POLL_INTERVAL_MS);
1085
1088
  return () => clearInterval(id);
1086
- }, [isActive, fetchDeployments2]);
1089
+ }, [isActive, awaitingBump, fetchDeployments2]);
1090
+ useEffect4(() => {
1091
+ if (!awaitingBump) return;
1092
+ if (latest?.uid && latest.uid !== bumpedFromUidRef.current) setAwaitingBump(false);
1093
+ }, [awaitingBump, latest?.uid]);
1094
+ useEffect4(() => {
1095
+ if (!awaitingBump) return;
1096
+ const id = setTimeout(() => setAwaitingBump(false), BUMP_WATCH_TIMEOUT_MS);
1097
+ return () => clearTimeout(id);
1098
+ }, [awaitingBump]);
1087
1099
  useEffect4(() => {
1088
1100
  if (!isPending) return;
1089
1101
  if (latest?.uid && latest.uid !== triggeredFromUidRef.current) setPendingSince(null);
@@ -1213,6 +1225,8 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1213
1225
  // failure. Unused by workflow-dispatch mode.
1214
1226
  studioToken: client.config().token
1215
1227
  });
1228
+ bumpedFromUidRef.current = latest?.uid;
1229
+ setAwaitingBump(true);
1216
1230
  setBumpResult({
1217
1231
  ok: true,
1218
1232
  message: `Version bump requested on ${ref}. The new deploy appears here in a minute or two.`
@@ -1229,7 +1243,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1229
1243
  } finally {
1230
1244
  setBumping(false);
1231
1245
  }
1232
- }, [pluginConfig.unblock, latest?.meta?.githubCommitRef, currentUser, target.name, toast, client]);
1246
+ }, [pluginConfig.unblock, latest?.meta?.githubCommitRef, latest?.uid, currentUser, target.name, toast, client]);
1233
1247
  const branch = latest?.meta?.githubCommitRef;
1234
1248
  const commitMsg = latest?.meta?.githubCommitMessage?.split("\n")[0];
1235
1249
  const sha = shortSha(latest?.meta?.githubCommitSha);
@@ -1443,9 +1457,12 @@ function DeployItem({ target, token, onDelete, onEdit }) {
1443
1457
  ", which Vercel will build."
1444
1458
  ] })
1445
1459
  ] }) : /* @__PURE__ */ jsx10(Text, { size: 0, muted: true, children: pluginConfig.unblock ? "This deployment carries no branch information, so a version bump cannot be targeted. Ask a developer to deploy manually." : "Ask a developer to push a version bump \u2014 a commit by an authorised author is needed before this site can deploy." }),
1446
- bumpResult && /* @__PURE__ */ jsxs6(Text, { size: 0, weight: bumpResult.ok ? "semibold" : void 0, children: [
1447
- bumpResult.ok ? "\u2713 " : "",
1448
- bumpResult.message
1460
+ bumpResult && /* @__PURE__ */ jsxs6(Flex, { align: "center", gap: 2, children: [
1461
+ awaitingBump && /* @__PURE__ */ jsx10(Spinner, { muted: true }),
1462
+ /* @__PURE__ */ jsxs6(Text, { size: 0, weight: bumpResult.ok ? "semibold" : void 0, children: [
1463
+ bumpResult.ok && !awaitingBump ? "\u2713 " : "",
1464
+ bumpResult.message
1465
+ ] })
1449
1466
  ] })
1450
1467
  ] }) })
1451
1468
  ] }),
@@ -1835,7 +1852,7 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
1835
1852
  }
1836
1853
 
1837
1854
  // src/version.ts
1838
- var VERSION = "1.5.0";
1855
+ var VERSION = "1.5.1";
1839
1856
 
1840
1857
  // src/components/DeployTool.tsx
1841
1858
  import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liiift-studio/deploy-vercel-from-sanity",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Sanity Studio plugin — trigger and monitor Vercel deployments with full status, history, and build logs. Supports Studio v3.30 through v6.",
5
5
  "license": "MIT",
6
6
  "author": "Liiift Studio",