@liiift-studio/deploy-vercel-from-sanity 1.0.0 → 1.0.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/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -9
- package/dist/index.mjs +8 -9
- package/package.json +1 -1
- package/src/components/DeployItem.tsx +9 -9
- package/src/types.ts +3 -1
package/dist/index.d.mts
CHANGED
|
@@ -19,8 +19,10 @@ interface VercelDeployment {
|
|
|
19
19
|
/** Preview hostname, e.g. my-project-abc123.vercel.app */
|
|
20
20
|
url: string;
|
|
21
21
|
state: VercelDeployState;
|
|
22
|
-
/** Unix ms timestamp */
|
|
22
|
+
/** Unix ms timestamp — when the deployment was created */
|
|
23
23
|
created: number;
|
|
24
|
+
/** Unix ms timestamp — when the deployment became ready */
|
|
25
|
+
ready?: number;
|
|
24
26
|
/** Link to the Vercel dashboard page for this deployment */
|
|
25
27
|
inspectorUrl?: string;
|
|
26
28
|
creator?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,10 @@ interface VercelDeployment {
|
|
|
19
19
|
/** Preview hostname, e.g. my-project-abc123.vercel.app */
|
|
20
20
|
url: string;
|
|
21
21
|
state: VercelDeployState;
|
|
22
|
-
/** Unix ms timestamp */
|
|
22
|
+
/** Unix ms timestamp — when the deployment was created */
|
|
23
23
|
created: number;
|
|
24
|
+
/** Unix ms timestamp — when the deployment became ready */
|
|
25
|
+
ready?: number;
|
|
24
26
|
/** Link to the Vercel dashboard page for this deployment */
|
|
25
27
|
inspectorUrl?: string;
|
|
26
28
|
creator?: {
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ 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");
|
|
38
39
|
var import_ui3 = require("@sanity/ui");
|
|
39
40
|
var import_icons2 = require("@sanity/icons");
|
|
40
41
|
|
|
@@ -358,7 +359,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
358
359
|
}, [isActive, latest?.created]);
|
|
359
360
|
const deploy = (0, import_react2.useCallback)(async () => {
|
|
360
361
|
setDeployError(null);
|
|
361
|
-
setTriggering(true);
|
|
362
|
+
(0, import_react_dom.flushSync)(() => setTriggering(true));
|
|
362
363
|
try {
|
|
363
364
|
await triggerDeploy(target.url);
|
|
364
365
|
setTimeout(fetchDeployments, 2e3);
|
|
@@ -432,10 +433,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
432
433
|
/* @__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" }) })
|
|
433
434
|
] }) }),
|
|
434
435
|
token && !loadingInitial && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
435
|
-
triggering ? /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
436
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Spinner, { muted: true }),
|
|
437
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Badge, { tone: "caution", padding: 2, children: "Triggering\u2026" })
|
|
438
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StatusBadge, { state: latest?.state, showSpinner: true }),
|
|
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, showSpinner: true }),
|
|
439
437
|
isActiveState(latest?.state) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
440
438
|
import_ui3.Button,
|
|
441
439
|
{
|
|
@@ -448,10 +446,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
448
446
|
style: { cursor: "pointer" }
|
|
449
447
|
}
|
|
450
448
|
),
|
|
451
|
-
isActive && elapsed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
452
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Spinner, { muted: true }),
|
|
453
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, children: formatDuration(elapsed) })
|
|
454
|
-
] }) : !isActive && deployedAt ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, children: deployedAt }) : null
|
|
449
|
+
isActive && elapsed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, children: formatDuration(elapsed) }) : !isActive && deployedAt ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, children: deployedAt }) : null
|
|
455
450
|
] })
|
|
456
451
|
] }),
|
|
457
452
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -549,6 +544,10 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
549
544
|
"by ",
|
|
550
545
|
creator
|
|
551
546
|
] }),
|
|
547
|
+
latest?.state === "READY" && latest.ready && latest.created && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui3.Text, { size: 1, muted: true, children: [
|
|
548
|
+
"\xB7 ",
|
|
549
|
+
formatDuration(Math.floor((latest.ready - latest.created) / 1e3))
|
|
550
|
+
] }),
|
|
552
551
|
latest?.url && latest.state === "READY" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
553
552
|
import_ui3.Tooltip,
|
|
554
553
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -21,6 +21,7 @@ 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";
|
|
24
25
|
import {
|
|
25
26
|
Card as Card2,
|
|
26
27
|
Box as Box2,
|
|
@@ -380,7 +381,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
380
381
|
}, [isActive, latest?.created]);
|
|
381
382
|
const deploy = useCallback2(async () => {
|
|
382
383
|
setDeployError(null);
|
|
383
|
-
setTriggering(true);
|
|
384
|
+
flushSync(() => setTriggering(true));
|
|
384
385
|
try {
|
|
385
386
|
await triggerDeploy(target.url);
|
|
386
387
|
setTimeout(fetchDeployments, 2e3);
|
|
@@ -454,10 +455,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
454
455
|
/* @__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" }) })
|
|
455
456
|
] }) }),
|
|
456
457
|
token && !loadingInitial && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
457
|
-
triggering ? /* @__PURE__ */
|
|
458
|
-
/* @__PURE__ */ jsx3(Spinner3, { muted: true }),
|
|
459
|
-
/* @__PURE__ */ jsx3(Badge3, { tone: "caution", padding: 2, children: "Triggering\u2026" })
|
|
460
|
-
] }) : /* @__PURE__ */ jsx3(StatusBadge, { state: latest?.state, showSpinner: true }),
|
|
458
|
+
triggering ? /* @__PURE__ */ jsx3(Badge3, { tone: "caution", padding: 2, children: "Triggering\u2026" }) : /* @__PURE__ */ jsx3(StatusBadge, { state: latest?.state, showSpinner: true }),
|
|
461
459
|
isActiveState(latest?.state) && /* @__PURE__ */ jsx3(
|
|
462
460
|
Button2,
|
|
463
461
|
{
|
|
@@ -470,10 +468,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
470
468
|
style: { cursor: "pointer" }
|
|
471
469
|
}
|
|
472
470
|
),
|
|
473
|
-
isActive && elapsed > 0 ? /* @__PURE__ */
|
|
474
|
-
/* @__PURE__ */ jsx3(Spinner3, { muted: true }),
|
|
475
|
-
/* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, children: formatDuration(elapsed) })
|
|
476
|
-
] }) : !isActive && deployedAt ? /* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, children: deployedAt }) : null
|
|
471
|
+
isActive && elapsed > 0 ? /* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, children: formatDuration(elapsed) }) : !isActive && deployedAt ? /* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, children: deployedAt }) : null
|
|
477
472
|
] })
|
|
478
473
|
] }),
|
|
479
474
|
/* @__PURE__ */ jsx3(
|
|
@@ -571,6 +566,10 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
571
566
|
"by ",
|
|
572
567
|
creator
|
|
573
568
|
] }),
|
|
569
|
+
latest?.state === "READY" && latest.ready && latest.created && /* @__PURE__ */ jsxs3(Text2, { size: 1, muted: true, children: [
|
|
570
|
+
"\xB7 ",
|
|
571
|
+
formatDuration(Math.floor((latest.ready - latest.created) / 1e3))
|
|
572
|
+
] }),
|
|
574
573
|
latest?.url && latest.state === "READY" && /* @__PURE__ */ jsx3(Fragment, { children: /* @__PURE__ */ jsx3(
|
|
575
574
|
Tooltip,
|
|
576
575
|
{
|
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.2",
|
|
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,5 +1,6 @@
|
|
|
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'
|
|
3
4
|
import {
|
|
4
5
|
Card, Box, Stack, Flex, Text, Button, Tooltip, Badge, Spinner,
|
|
5
6
|
MenuButton, Menu, MenuItem, Code, useToast,
|
|
@@ -112,7 +113,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
|
|
|
112
113
|
// ── Actions ───────────────────────────────────────────────────────────────
|
|
113
114
|
const deploy = useCallback(async () => {
|
|
114
115
|
setDeployError(null)
|
|
115
|
-
setTriggering(true)
|
|
116
|
+
flushSync(() => setTriggering(true))
|
|
116
117
|
try {
|
|
117
118
|
await triggerDeploy(target.url)
|
|
118
119
|
setTimeout(fetchDeployments, 2000)
|
|
@@ -214,10 +215,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
|
|
|
214
215
|
{token && !loadingInitial && (
|
|
215
216
|
<>
|
|
216
217
|
{triggering ? (
|
|
217
|
-
<
|
|
218
|
-
<Spinner muted />
|
|
219
|
-
<Badge tone="caution" padding={2}>Triggering…</Badge>
|
|
220
|
-
</Flex>
|
|
218
|
+
<Badge tone="caution" padding={2}>Triggering…</Badge>
|
|
221
219
|
) : (
|
|
222
220
|
<StatusBadge state={latest?.state} showSpinner />
|
|
223
221
|
)}
|
|
@@ -233,10 +231,7 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
|
|
|
233
231
|
/>
|
|
234
232
|
)}
|
|
235
233
|
{isActive && elapsed > 0 ? (
|
|
236
|
-
<
|
|
237
|
-
<Spinner muted />
|
|
238
|
-
<Text size={1} muted>{formatDuration(elapsed)}</Text>
|
|
239
|
-
</Flex>
|
|
234
|
+
<Text size={1} muted>{formatDuration(elapsed)}</Text>
|
|
240
235
|
) : (!isActive && deployedAt) ? (
|
|
241
236
|
<Text size={1} muted>{deployedAt}</Text>
|
|
242
237
|
) : null}
|
|
@@ -357,6 +352,11 @@ export function DeployItem({ target, token, onDelete, onEdit }: DeployItemProps)
|
|
|
357
352
|
{/* Creator */}
|
|
358
353
|
{creator && <Text size={1} muted>by {creator}</Text>}
|
|
359
354
|
|
|
355
|
+
{/* Build duration — only shown when READY and ready timestamp is available */}
|
|
356
|
+
{latest?.state === 'READY' && latest.ready && latest.created && (
|
|
357
|
+
<Text size={1} muted>· {formatDuration(Math.floor((latest.ready - latest.created) / 1000))}</Text>
|
|
358
|
+
)}
|
|
359
|
+
|
|
360
360
|
{/* Visit link + copy URL */}
|
|
361
361
|
{latest?.url && latest.state === 'READY' && (
|
|
362
362
|
<>
|
package/src/types.ts
CHANGED
|
@@ -28,8 +28,10 @@ export interface VercelDeployment {
|
|
|
28
28
|
/** Preview hostname, e.g. my-project-abc123.vercel.app */
|
|
29
29
|
url: string
|
|
30
30
|
state: VercelDeployState
|
|
31
|
-
/** Unix ms timestamp */
|
|
31
|
+
/** Unix ms timestamp — when the deployment was created */
|
|
32
32
|
created: number
|
|
33
|
+
/** Unix ms timestamp — when the deployment became ready */
|
|
34
|
+
ready?: number
|
|
33
35
|
/** Link to the Vercel dashboard page for this deployment */
|
|
34
36
|
inspectorUrl?: string
|
|
35
37
|
creator?: {
|