@liiift-studio/deploy-vercel-from-sanity 1.1.1 → 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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@liiift-studio/deploy-vercel-from-sanity",
3
- "version": "1.1.1",
4
- "description": "Sanity Studio plugin — trigger and monitor Vercel deployments with full status, history, and build logs. Supports Studio v3 through v6.",
3
+ "version": "1.2.1",
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",
7
7
  "keywords": [
@@ -22,16 +22,20 @@
22
22
  "types": "./dist/index.d.ts",
23
23
  "exports": {
24
24
  ".": {
25
- "source": "./src/index.ts",
26
- "import": "./dist/index.mjs",
27
- "require": "./dist/index.js",
25
+ "import": {
26
+ "types": "./dist/index.d.mts",
27
+ "default": "./dist/index.mjs"
28
+ },
29
+ "require": {
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
+ },
28
33
  "default": "./dist/index.mjs"
29
34
  },
30
35
  "./package.json": "./package.json"
31
36
  },
32
37
  "files": [
33
- "dist",
34
- "src"
38
+ "dist"
35
39
  ],
36
40
  "scripts": {
37
41
  "build": "tsup",
@@ -39,10 +43,11 @@
39
43
  "prepublishOnly": "npm run build"
40
44
  },
41
45
  "peerDependencies": {
42
- "@sanity/icons": ">=2",
43
- "@sanity/ui": ">=2",
46
+ "@sanity/icons": ">=2 <6",
47
+ "@sanity/ui": ">=2 <5",
44
48
  "react": ">=18",
45
- "sanity": ">=3"
49
+ "react-dom": ">=18",
50
+ "sanity": ">=3.30 <7"
46
51
  },
47
52
  "devDependencies": {
48
53
  "@sanity/icons": "^5",
@@ -52,10 +57,15 @@
52
57
  "react": "^19",
53
58
  "sanity": "^6",
54
59
  "tsup": "^8",
55
- "typescript": "^5"
60
+ "typescript": "^5",
61
+ "react-dom": "^19"
56
62
  },
57
63
  "repository": {
58
64
  "type": "git",
59
65
  "url": "https://github.com/Liiift-Studio/Deploy-Vercel-from-Sanity"
66
+ },
67
+ "sideEffects": true,
68
+ "engines": {
69
+ "node": ">=20.19 <22 || >=22.12"
60
70
  }
61
71
  }
@@ -1,158 +0,0 @@
1
- // Deployment history modal — shows last 10 deployments for a target
2
- import { useEffect, useState, useCallback } from 'react'
3
- import {
4
- Dialog, Card, Box, Flex, Text, Badge, Spinner, Button,
5
- } from '@sanity/ui'
6
- import { Stack } from '../ui'
7
- import { LaunchIcon, CloseIcon } from '../icons'
8
- import { listDeployments } from '../lib/api'
9
- import { parseHookUrl, stateLabel, timeAgo, shortSha, safeHref } from '../lib/helpers'
10
- import type { DeployTarget, VercelDeployment } from '../types'
11
-
12
- interface DeployHistoryProps {
13
- target: DeployTarget
14
- token: string
15
- onClose: () => void
16
- }
17
-
18
- export function DeployHistory({ target, token, onClose }: DeployHistoryProps) {
19
- const [deployments, setDeployments] = useState<VercelDeployment[]>([])
20
- const [loading, setLoading] = useState(true)
21
- const [error, setError] = useState<string | null>(null)
22
-
23
- const { projectId, hookId } = parseHookUrl(target.url)
24
-
25
- const load = useCallback(async () => {
26
- setLoading(true)
27
- setError(null)
28
- try {
29
- const data = await listDeployments({ projectId, hookId, token, teamId: target.teamId, limit: 10 })
30
- setDeployments(data)
31
- } catch (err) {
32
- setError(err instanceof Error ? err.message : 'Failed to load history')
33
- } finally {
34
- setLoading(false)
35
- }
36
- }, [projectId, hookId, token, target.teamId])
37
-
38
- useEffect(() => { load() }, [load])
39
-
40
- return (
41
- <Dialog
42
- header={`${target.name} — Deployment History`}
43
- id="deploy-history"
44
- onClose={onClose}
45
- width={2}
46
- footer={
47
- <Box padding={3}>
48
- <Button text="Close" icon={CloseIcon} mode="ghost" onClick={onClose} />
49
- </Box>
50
- }
51
- >
52
- <Box padding={4}>
53
- {loading && (
54
- <Flex justify="center" padding={6}>
55
- <Spinner muted />
56
- </Flex>
57
- )}
58
-
59
- {error && (
60
- <Card tone="critical" padding={4} radius={2}>
61
- <Text size={1}>{error}</Text>
62
- </Card>
63
- )}
64
-
65
- {!loading && !error && deployments.length === 0 && (
66
- <Card tone="transparent" padding={4}>
67
- <Text size={1} muted align="center">No deployments found for this hook.</Text>
68
- </Card>
69
- )}
70
-
71
- {!loading && deployments.length > 0 && (
72
- <Stack space={2}>
73
- {/* Column headers */}
74
- <Card padding={3} radius={2} tone="transparent">
75
- <Flex gap={3}>
76
- <Box flex={2}><Text size={0} weight="semibold" muted>Preview URL</Text></Box>
77
- <Box flex={1}><Text size={0} weight="semibold" muted>Status</Text></Box>
78
- <Box flex={2}><Text size={0} weight="semibold" muted>Branch · Commit</Text></Box>
79
- <Box flex={1}><Text size={0} weight="semibold" muted>Deployed</Text></Box>
80
- <Box style={{ width: 64 }}><Text size={0} weight="semibold" muted>Logs</Text></Box>
81
- </Flex>
82
- </Card>
83
-
84
- {deployments.map(d => {
85
- const { label, tone } = stateLabel(d.state)
86
- const branch = d.meta?.githubCommitRef ?? '—'
87
- const sha = shortSha(d.meta?.githubCommitSha)
88
- const message = d.meta?.githubCommitMessage?.split('\n')[0] ?? ''
89
-
90
- return (
91
- <Card key={d.uid} padding={3} radius={2} shadow={1} tone="default">
92
- <Flex gap={3} align="center">
93
- {/* Preview URL */}
94
- <Box flex={2} style={{ overflow: 'hidden' }}>
95
- {d.url ? (
96
- <a
97
- href={`https://${d.url}`}
98
- target="_blank"
99
- rel="noreferrer"
100
- style={{ color: 'inherit' }}
101
- >
102
- <Text size={1} style={{ textDecoration: 'underline' }}>
103
- {d.url.length > 36 ? `${d.url.slice(0, 36)}…` : d.url}
104
- </Text>
105
- </a>
106
- ) : (
107
- <Text size={1} muted>—</Text>
108
- )}
109
- </Box>
110
-
111
- {/* Status */}
112
- <Box flex={1}>
113
- <Badge tone={tone}>{label}</Badge>
114
- </Box>
115
-
116
- {/* Branch + commit */}
117
- <Box flex={2} style={{ overflow: 'hidden' }}>
118
- <Stack space={1}>
119
- <Text size={1}>{branch}</Text>
120
- {sha && (
121
- <Text size={0} muted>
122
- {sha}{message ? ` · ${message.slice(0, 40)}${message.length > 40 ? '…' : ''}` : ''}
123
- </Text>
124
- )}
125
- </Stack>
126
- </Box>
127
-
128
- {/* Time */}
129
- <Box flex={1}>
130
- <Text size={1} muted>{timeAgo(d.created)}</Text>
131
- </Box>
132
-
133
- {/* Build logs link */}
134
- <Box style={{ width: 64 }}>
135
- {safeHref(d.inspectorUrl) ? (
136
- <a href={safeHref(d.inspectorUrl)} target="_blank" rel="noreferrer">
137
- <Button
138
- text="Logs"
139
- mode="ghost"
140
- tone="default"
141
- icon={LaunchIcon}
142
- style={{ fontSize: '12px' }}
143
- />
144
- </a>
145
- ) : (
146
- <Text size={1} muted>—</Text>
147
- )}
148
- </Box>
149
- </Flex>
150
- </Card>
151
- )
152
- })}
153
- </Stack>
154
- )}
155
- </Box>
156
- </Dialog>
157
- )
158
- }