@liiift-studio/deploy-vercel-from-sanity 1.2.0 → 1.2.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 +1 -1
- package/dist/index.d.mts +1 -33
- package/dist/index.d.ts +1 -33
- package/dist/index.js +185 -99
- package/dist/index.mjs +195 -108
- package/package.json +12 -8
- package/src/compat/code.tsx +0 -29
- package/src/compat/index.ts +0 -14
- package/src/compat/menu.tsx +0 -225
- package/src/compat/primitives.tsx +0 -93
- package/src/compat/resolve.ts +0 -55
- package/src/compat/toast.tsx +0 -173
- package/src/compat/tooltip.tsx +0 -78
- package/src/components/DeployHistory.tsx +0 -160
- package/src/components/DeployItem.tsx +0 -596
- package/src/components/DeployTargetForm.tsx +0 -172
- package/src/components/DeployTool.tsx +0 -318
- package/src/components/StatusBadge.tsx +0 -23
- package/src/components/TokenSetup.tsx +0 -98
- package/src/icons.tsx +0 -78
- package/src/index.ts +0 -47
- package/src/lib/api.ts +0 -102
- package/src/lib/helpers.ts +0 -131
- package/src/schema/schemaIcon.tsx +0 -38
- package/src/schema/vercelConfig.ts +0 -34
- package/src/schema/vercelDeploy.ts +0 -49
- package/src/types.ts +0 -77
- package/src/version.ts +0 -2
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
// Deployment history modal — shows last 10 deployments for a target
|
|
2
|
-
import { useEffect, useState, useCallback } from 'react'
|
|
3
|
-
import { LaunchIcon, CloseIcon } from '../icons'
|
|
4
|
-
import { listDeployments } from '../lib/api'
|
|
5
|
-
import { parseHookUrl, stateLabel, timeAgo, shortSha, safeHref, deploymentHref } from '../lib/helpers'
|
|
6
|
-
import type { DeployTarget, VercelDeployment } from '../types'
|
|
7
|
-
import { Badge, Box, Button, Card, Dialog, Flex, Spinner, Stack, Text } from '../compat'
|
|
8
|
-
|
|
9
|
-
interface DeployHistoryProps {
|
|
10
|
-
target: DeployTarget
|
|
11
|
-
token: string
|
|
12
|
-
onClose: () => void
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function DeployHistory({ target, token, onClose }: DeployHistoryProps) {
|
|
16
|
-
const [deployments, setDeployments] = useState<VercelDeployment[]>([])
|
|
17
|
-
const [loading, setLoading] = useState(true)
|
|
18
|
-
const [error, setError] = useState<string | null>(null)
|
|
19
|
-
|
|
20
|
-
const { projectId, hookId } = parseHookUrl(target.url)
|
|
21
|
-
|
|
22
|
-
const load = useCallback(async () => {
|
|
23
|
-
setLoading(true)
|
|
24
|
-
setError(null)
|
|
25
|
-
try {
|
|
26
|
-
const data = await listDeployments({ projectId, hookId, token, teamId: target.teamId, limit: 10 })
|
|
27
|
-
setDeployments(data)
|
|
28
|
-
} catch (err) {
|
|
29
|
-
setError(err instanceof Error ? err.message : 'Failed to load history')
|
|
30
|
-
} finally {
|
|
31
|
-
setLoading(false)
|
|
32
|
-
}
|
|
33
|
-
}, [projectId, hookId, token, target.teamId])
|
|
34
|
-
|
|
35
|
-
useEffect(() => { load() }, [load])
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Dialog
|
|
39
|
-
header={`${target.name} — Deployment History`}
|
|
40
|
-
id="deploy-history"
|
|
41
|
-
onClose={onClose}
|
|
42
|
-
width={2}
|
|
43
|
-
footer={
|
|
44
|
-
<Box padding={3}>
|
|
45
|
-
<Button text="Close" icon={CloseIcon} mode="ghost" onClick={onClose} />
|
|
46
|
-
</Box>
|
|
47
|
-
}
|
|
48
|
-
>
|
|
49
|
-
<Box padding={4}>
|
|
50
|
-
{loading && (
|
|
51
|
-
<Flex justify="center" padding={6}>
|
|
52
|
-
<Spinner muted />
|
|
53
|
-
</Flex>
|
|
54
|
-
)}
|
|
55
|
-
|
|
56
|
-
{error && (
|
|
57
|
-
<Card tone="critical" padding={4} radius={2}>
|
|
58
|
-
<Text size={1}>{error}</Text>
|
|
59
|
-
</Card>
|
|
60
|
-
)}
|
|
61
|
-
|
|
62
|
-
{!loading && !error && deployments.length === 0 && (
|
|
63
|
-
<Card tone="transparent" padding={4}>
|
|
64
|
-
<Text size={1} muted align="center">No deployments found for this hook.</Text>
|
|
65
|
-
</Card>
|
|
66
|
-
)}
|
|
67
|
-
|
|
68
|
-
{!loading && deployments.length > 0 && (
|
|
69
|
-
<Stack space={2}>
|
|
70
|
-
{/* Column headers */}
|
|
71
|
-
<Card padding={3} radius={2} tone="transparent">
|
|
72
|
-
<Flex gap={3}>
|
|
73
|
-
<Box flex={2}><Text size={0} weight="semibold" muted>Preview URL</Text></Box>
|
|
74
|
-
<Box flex={1}><Text size={0} weight="semibold" muted>Status</Text></Box>
|
|
75
|
-
<Box flex={2}><Text size={0} weight="semibold" muted>Branch · Commit</Text></Box>
|
|
76
|
-
<Box flex={1}><Text size={0} weight="semibold" muted>Deployed</Text></Box>
|
|
77
|
-
<Box style={{ width: 64 }}><Text size={0} weight="semibold" muted>Logs</Text></Box>
|
|
78
|
-
</Flex>
|
|
79
|
-
</Card>
|
|
80
|
-
|
|
81
|
-
{deployments.map(d => {
|
|
82
|
-
const { label, tone } = stateLabel(d.state)
|
|
83
|
-
const branch = d.meta?.githubCommitRef ?? '—'
|
|
84
|
-
const sha = shortSha(d.meta?.githubCommitSha)
|
|
85
|
-
const message = d.meta?.githubCommitMessage?.split('\n')[0] ?? ''
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<Card key={d.uid} padding={3} radius={2} shadow={1} tone="default">
|
|
89
|
-
<Flex gap={3} align="center">
|
|
90
|
-
{/* Preview URL */}
|
|
91
|
-
<Box flex={2} style={{ overflow: 'hidden' }}>
|
|
92
|
-
{deploymentHref(d.url) ? (
|
|
93
|
-
<a
|
|
94
|
-
href={deploymentHref(d.url)}
|
|
95
|
-
target="_blank"
|
|
96
|
-
rel="noreferrer"
|
|
97
|
-
style={{ color: 'inherit' }}
|
|
98
|
-
>
|
|
99
|
-
<Text size={1} style={{ textDecoration: 'underline' }}>
|
|
100
|
-
{d.url.length > 36 ? `${d.url.slice(0, 36)}…` : d.url}
|
|
101
|
-
</Text>
|
|
102
|
-
</a>
|
|
103
|
-
) : (
|
|
104
|
-
<Text size={1} muted>—</Text>
|
|
105
|
-
)}
|
|
106
|
-
</Box>
|
|
107
|
-
|
|
108
|
-
{/* Status */}
|
|
109
|
-
<Box flex={1}>
|
|
110
|
-
<Badge tone={tone}>{label}</Badge>
|
|
111
|
-
</Box>
|
|
112
|
-
|
|
113
|
-
{/* Branch + commit */}
|
|
114
|
-
<Box flex={2} style={{ overflow: 'hidden' }}>
|
|
115
|
-
<Stack space={1}>
|
|
116
|
-
<Text size={1}>{branch}</Text>
|
|
117
|
-
{sha && (
|
|
118
|
-
<Text size={0} muted>
|
|
119
|
-
{sha}{message ? ` · ${message.slice(0, 40)}${message.length > 40 ? '…' : ''}` : ''}
|
|
120
|
-
</Text>
|
|
121
|
-
)}
|
|
122
|
-
</Stack>
|
|
123
|
-
</Box>
|
|
124
|
-
|
|
125
|
-
{/* Time */}
|
|
126
|
-
<Box flex={1}>
|
|
127
|
-
<Text size={1} muted>{timeAgo(d.created)}</Text>
|
|
128
|
-
</Box>
|
|
129
|
-
|
|
130
|
-
{/* Build logs link. Rendered as a link, not a Button inside an anchor:
|
|
131
|
-
nesting interactive content in <a> gives two focus stops and Enter
|
|
132
|
-
activates the button, which has no handler, so the link never opens
|
|
133
|
-
for keyboard users. */}
|
|
134
|
-
<Box style={{ width: 64 }}>
|
|
135
|
-
{safeHref(d.inspectorUrl) ? (
|
|
136
|
-
<Button
|
|
137
|
-
as="a"
|
|
138
|
-
href={safeHref(d.inspectorUrl)}
|
|
139
|
-
target="_blank"
|
|
140
|
-
rel="noreferrer"
|
|
141
|
-
text="Logs"
|
|
142
|
-
mode="ghost"
|
|
143
|
-
tone="default"
|
|
144
|
-
icon={LaunchIcon}
|
|
145
|
-
style={{ fontSize: '12px' }}
|
|
146
|
-
/>
|
|
147
|
-
) : (
|
|
148
|
-
<Text size={1} muted>—</Text>
|
|
149
|
-
)}
|
|
150
|
-
</Box>
|
|
151
|
-
</Flex>
|
|
152
|
-
</Card>
|
|
153
|
-
)
|
|
154
|
-
})}
|
|
155
|
-
</Stack>
|
|
156
|
-
)}
|
|
157
|
-
</Box>
|
|
158
|
-
</Dialog>
|
|
159
|
-
)
|
|
160
|
-
}
|