| 106 | } |
| 107 | |
| 108 | async function readErrorMessage(response: Response): Promise<string> { |
| 109 | const errorText = await response.text().catch(() => "") |
| 110 | if (!errorText) { |
| 111 | return `Deploy failed (${response.status})` |
| 112 | } |
| 113 | |
| 114 | try { |
| 115 | const parsed = JSON.parse(errorText) as { message?: string } |
| 116 | if (typeof parsed.message === "string" && parsed.message.length > 0) { |
| 117 | return parsed.message |
| 118 | } |
| 119 | } catch {} |
| 120 | |
| 121 | return errorText |
| 122 | } |
| 123 | |
| 124 | export async function deploy() { |
| 125 | p.intro("@21st-sdk/cli deploy") |