@liiift-studio/deploy-vercel-from-sanity 1.0.2 → 1.0.3
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/index.js +19 -14
- package/dist/index.mjs +19 -14
- package/package.json +1 -1
- package/src/components/DeployItem.tsx +17 -13
package/dist/index.js
CHANGED
|
@@ -35,7 +35,6 @@ var import_icons5 = require("@sanity/icons");
|
|
|
35
35
|
|
|
36
36
|
// src/components/DeployItem.tsx
|
|
37
37
|
var import_react2 = require("react");
|
|
38
|
-
var import_react_dom = require("react-dom");
|
|
39
38
|
var import_ui3 = require("@sanity/ui");
|
|
40
39
|
var import_icons2 = require("@sanity/icons");
|
|
41
40
|
|
|
@@ -357,16 +356,18 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
357
356
|
if (timerRef.current) clearInterval(timerRef.current);
|
|
358
357
|
};
|
|
359
358
|
}, [isActive, latest?.created]);
|
|
360
|
-
const deploy = (0, import_react2.useCallback)(
|
|
359
|
+
const deploy = (0, import_react2.useCallback)(() => {
|
|
361
360
|
setDeployError(null);
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
361
|
+
setTriggering(true);
|
|
362
|
+
void (async () => {
|
|
363
|
+
try {
|
|
364
|
+
await triggerDeploy(target.url);
|
|
365
|
+
setTimeout(fetchDeployments, 2e3);
|
|
366
|
+
} catch (err) {
|
|
367
|
+
setTriggering(false);
|
|
368
|
+
setDeployError(err instanceof Error ? err.message : "Deploy failed");
|
|
369
|
+
}
|
|
370
|
+
})();
|
|
370
371
|
}, [target.url, fetchDeployments]);
|
|
371
372
|
const cancel = (0, import_react2.useCallback)(async () => {
|
|
372
373
|
if (!latest?.uid) return;
|
|
@@ -433,7 +434,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
433
434
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", style: { marginLeft: "-0.1em", opacity: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm0 2.122a2.25 2.25 0 1 0-1.5 0v.878A2.25 2.25 0 0 0 5.75 8.5h1.5v2.128a2.251 2.251 0 1 0 1.5 0V8.5h1.5a2.25 2.25 0 0 0 2.25-2.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75h-4.5A.75.75 0 0 1 5 6.25v-.878zm3.75 7.378a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm3-8.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0z" }) })
|
|
434
435
|
] }) }),
|
|
435
436
|
token && !loadingInitial && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
436
|
-
triggering ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Badge, { tone: "caution", padding: 2, children: "Triggering\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StatusBadge, { state: latest?.state
|
|
437
|
+
triggering ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Badge, { tone: "caution", padding: 2, children: "Triggering\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StatusBadge, { state: latest?.state }),
|
|
437
438
|
isActiveState(latest?.state) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
438
439
|
import_ui3.Button,
|
|
439
440
|
{
|
|
@@ -446,7 +447,10 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
446
447
|
style: { cursor: "pointer" }
|
|
447
448
|
}
|
|
448
449
|
),
|
|
449
|
-
isActive && elapsed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
450
|
+
isActive && elapsed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui3.Flex, { align: "center", gap: 1, children: [
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Spinner, { muted: true }),
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, children: formatDuration(elapsed) })
|
|
453
|
+
] }) : !isActive && deployedAt ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, children: deployedAt }) : null
|
|
450
454
|
] })
|
|
451
455
|
] }),
|
|
452
456
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -545,8 +549,9 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
545
549
|
creator
|
|
546
550
|
] }),
|
|
547
551
|
latest?.state === "READY" && latest.ready && latest.created && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui3.Text, { size: 1, muted: true, children: [
|
|
548
|
-
"
|
|
549
|
-
formatDuration(Math.floor((latest.ready - latest.created) / 1e3))
|
|
552
|
+
"Took ",
|
|
553
|
+
formatDuration(Math.floor((latest.ready - latest.created) / 1e3)),
|
|
554
|
+
" to build"
|
|
550
555
|
] }),
|
|
551
556
|
latest?.url && latest.state === "READY" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
552
557
|
import_ui3.Tooltip,
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,6 @@ import { TokenIcon, TrashIcon as TrashIcon2, WarningOutlineIcon as WarningOutlin
|
|
|
21
21
|
|
|
22
22
|
// src/components/DeployItem.tsx
|
|
23
23
|
import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2, useRef } from "react";
|
|
24
|
-
import { flushSync } from "react-dom";
|
|
25
24
|
import {
|
|
26
25
|
Card as Card2,
|
|
27
26
|
Box as Box2,
|
|
@@ -379,16 +378,18 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
379
378
|
if (timerRef.current) clearInterval(timerRef.current);
|
|
380
379
|
};
|
|
381
380
|
}, [isActive, latest?.created]);
|
|
382
|
-
const deploy = useCallback2(
|
|
381
|
+
const deploy = useCallback2(() => {
|
|
383
382
|
setDeployError(null);
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
383
|
+
setTriggering(true);
|
|
384
|
+
void (async () => {
|
|
385
|
+
try {
|
|
386
|
+
await triggerDeploy(target.url);
|
|
387
|
+
setTimeout(fetchDeployments, 2e3);
|
|
388
|
+
} catch (err) {
|
|
389
|
+
setTriggering(false);
|
|
390
|
+
setDeployError(err instanceof Error ? err.message : "Deploy failed");
|
|
391
|
+
}
|
|
392
|
+
})();
|
|
392
393
|
}, [target.url, fetchDeployments]);
|
|
393
394
|
const cancel = useCallback2(async () => {
|
|
394
395
|
if (!latest?.uid) return;
|
|
@@ -455,7 +456,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
455
456
|
/* @__PURE__ */ jsx3("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", style: { marginLeft: "-0.1em", opacity: 0.5 }, children: /* @__PURE__ */ jsx3("path", { d: "M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm0 2.122a2.25 2.25 0 1 0-1.5 0v.878A2.25 2.25 0 0 0 5.75 8.5h1.5v2.128a2.251 2.251 0 1 0 1.5 0V8.5h1.5a2.25 2.25 0 0 0 2.25-2.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75h-4.5A.75.75 0 0 1 5 6.25v-.878zm3.75 7.378a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm3-8.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0z" }) })
|
|
456
457
|
] }) }),
|
|
457
458
|
token && !loadingInitial && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
458
|
-
triggering ? /* @__PURE__ */ jsx3(Badge3, { tone: "caution", padding: 2, children: "Triggering\u2026" }) : /* @__PURE__ */ jsx3(StatusBadge, { state: latest?.state
|
|
459
|
+
triggering ? /* @__PURE__ */ jsx3(Badge3, { tone: "caution", padding: 2, children: "Triggering\u2026" }) : /* @__PURE__ */ jsx3(StatusBadge, { state: latest?.state }),
|
|
459
460
|
isActiveState(latest?.state) && /* @__PURE__ */ jsx3(
|
|
460
461
|
Button2,
|
|
461
462
|
{
|
|
@@ -468,7 +469,10 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
468
469
|
style: { cursor: "pointer" }
|
|
469
470
|
}
|
|
470
471
|
),
|
|
471
|
-
isActive && elapsed > 0 ? /* @__PURE__ */
|
|
472
|
+
isActive && elapsed > 0 ? /* @__PURE__ */ jsxs3(Flex3, { align: "center", gap: 1, children: [
|
|
473
|
+
/* @__PURE__ */ jsx3(Spinner3, { muted: true }),
|
|
474
|
+
/* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, children: formatDuration(elapsed) })
|
|
475
|
+
] }) : !isActive && deployedAt ? /* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, children: deployedAt }) : null
|
|
472
476
|
] })
|
|
473
477
|
] }),
|
|
474
478
|
/* @__PURE__ */ jsx3(
|
|
@@ -567,8 +571,9 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
567
571
|
creator
|
|
568
572
|
] }),
|
|
569
573
|
latest?.state === "READY" && latest.ready && latest.created && /* @__PURE__ */ jsxs3(Text2, { size: 1, muted: true, children: [
|
|
570
|
-
"
|
|
571
|
-
formatDuration(Math.floor((latest.ready - latest.created) / 1e3))
|
|
574
|
+
"Took ",
|
|
575
|
+
formatDuration(Math.floor((latest.ready - latest.created) / 1e3)),
|
|
576
|
+
" to build"
|
|
572
577
|
] }),
|
|
573
578
|
latest?.url && latest.state === "READY" && /* @__PURE__ */ jsx3(Fragment, { children: /* @__PURE__ */ jsx3(
|
|
574
579
|
Tooltip,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liiift-studio/deploy-vercel-from-sanity",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Sanity Studio plugin — trigger and monitor Vercel deployments with full status, history, and build logs. Supports v3, v4, and v5.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Liiift Studio",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Per-deploy-target card — shows status, build timer, history, cancel, deploy, copy URL, and error logs
|
|
2
2
|
import { useState, useEffect, useCallback, useRef } from 'react'
|
|
3
|
-
import { flushSync } from 'react-dom'
|
|
4
3
|
import {
|
|
5
4
|
Card, Box, Stack, Flex, Text, Button, Tooltip, Badge, Spinner,
|
|
6
5
|
MenuButton, Menu, MenuItem, Code, useToast,
|
|
@@ -111,16 +110,18 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
|
|
|
111
110
|
}, [isActive, latest?.created])
|
|
112
111
|
|
|
113
112
|
// ── Actions ───────────────────────────────────────────────────────────────
|
|
114
|
-
const deploy = useCallback(
|
|
113
|
+
const deploy = useCallback(() => {
|
|
115
114
|
setDeployError(null)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
setTriggering(true)
|
|
116
|
+
void (async () => {
|
|
117
|
+
try {
|
|
118
|
+
await triggerDeploy(target.url)
|
|
119
|
+
setTimeout(fetchDeployments, 2000)
|
|
120
|
+
} catch (err) {
|
|
121
|
+
setTriggering(false)
|
|
122
|
+
setDeployError(err instanceof Error ? err.message : 'Deploy failed')
|
|
123
|
+
}
|
|
124
|
+
})()
|
|
124
125
|
}, [target.url, fetchDeployments])
|
|
125
126
|
|
|
126
127
|
const cancel = useCallback(async () => {
|
|
@@ -217,7 +218,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
|
|
|
217
218
|
{triggering ? (
|
|
218
219
|
<Badge tone="caution" padding={2}>Triggering…</Badge>
|
|
219
220
|
) : (
|
|
220
|
-
<StatusBadge state={latest?.state}
|
|
221
|
+
<StatusBadge state={latest?.state} />
|
|
221
222
|
)}
|
|
222
223
|
{isActiveState(latest?.state) && (
|
|
223
224
|
<Button
|
|
@@ -231,7 +232,10 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
|
|
|
231
232
|
/>
|
|
232
233
|
)}
|
|
233
234
|
{isActive && elapsed > 0 ? (
|
|
234
|
-
<
|
|
235
|
+
<Flex align="center" gap={1}>
|
|
236
|
+
<Spinner muted />
|
|
237
|
+
<Text size={1} muted>{formatDuration(elapsed)}</Text>
|
|
238
|
+
</Flex>
|
|
235
239
|
) : (!isActive && deployedAt) ? (
|
|
236
240
|
<Text size={1} muted>{deployedAt}</Text>
|
|
237
241
|
) : null}
|
|
@@ -354,7 +358,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
|
|
|
354
358
|
|
|
355
359
|
{/* Build duration — only shown when READY and ready timestamp is available */}
|
|
356
360
|
{latest?.state === 'READY' && latest.ready && latest.created && (
|
|
357
|
-
<Text size={1} muted
|
|
361
|
+
<Text size={1} muted>Took {formatDuration(Math.floor((latest.ready - latest.created) / 1000))} to build</Text>
|
|
358
362
|
)}
|
|
359
363
|
|
|
360
364
|
{/* Visit link + copy URL */}
|