Skip to content

Commit 8c5f975

Browse files
fix: force latest vercel cli and improve url extraction for consistent deployment feedback
1 parent c8ce648 commit 8c5f975

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "api-documenter",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Self-hosted Postman alternative with folder-level RBAC and offline-first documentation",
55
"main": "./out/main/index.js",
66
"author": "Praneeth Kulukuri",

src/main/index.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -586,34 +586,42 @@ ipcMain.handle('deploy-to-vercel', async (_event, params: { databaseUrl: string,
586586
try {
587587
// 0. Ensure linked to a UNIQUE project name
588588
// This creates/links the Vercel project with a name unique to THIS local project
589-
await runVercelCommand(`npx vercel link --project ${vercelProjectName} --yes`)
589+
await runVercelCommand(`npx vercel@latest link --project ${vercelProjectName} --yes`)
590590

591591
// 1. Set DATABASE_URL
592-
const resDb = await runVercelCommand(`npx vercel env add DATABASE_URL production`, params.databaseUrl)
592+
const resDb = await runVercelCommand(`npx vercel@latest env add DATABASE_URL production`, params.databaseUrl)
593593
if (!resDb.success) {
594594
mainWindow?.webContents.send('deploy-output', `Note: Proceeding even if env var exists or failed to set.\n`)
595595
}
596596

597597
// 2. Set ADMIN_TOKEN if provided
598598
if (params.adminToken) {
599-
const resAdmin = await runVercelCommand(`npx vercel env add ADMIN_TOKEN production`, params.adminToken)
599+
const resAdmin = await runVercelCommand(`npx vercel@latest env add ADMIN_TOKEN production`, params.adminToken)
600600
if (!resAdmin.success) {
601601
mainWindow?.webContents.send('deploy-output', `Note: Proceeding even if env var exists or failed to set.\n`)
602602
}
603603
}
604604

605605
// 3. Final Production Deployment
606-
const resDeploy = await runVercelCommand(`npx vercel --prod --yes`)
606+
const resDeploy = await runVercelCommand(`npx vercel@latest --prod --yes`)
607607

608608
if (resDeploy.success && resDeploy.output) {
609609
const lines = resDeploy.output.split('\n')
610610
let url = ''
611611

612612
for (const line of lines) {
613-
const prodMatch = line.match(/Production:\s*(https:\/\/\S+)/i)
613+
// Look for Aliased URL (preferred clean domain)
614614
const aliasMatch = line.match(/Aliased:\s*(https:\/\/\S+)/i)
615-
if (aliasMatch) url = aliasMatch[1]
616-
else if (prodMatch && !url) url = prodMatch[1]
615+
if (aliasMatch) {
616+
url = aliasMatch[1]
617+
continue
618+
}
619+
620+
// Look for Production URL (backup if alias not found yet)
621+
const prodMatch = line.match(/Production:\s*(https:\/\/\S+)/i)
622+
if (prodMatch && !url) {
623+
url = prodMatch[1]
624+
}
617625
}
618626

619627
if (url) {
@@ -642,7 +650,7 @@ ipcMain.handle('delete-vercel-project', async (_event, params: { projectId: stri
642650

643651
return new Promise((resolve) => {
644652
const shell = process.platform === 'win32' ? 'cmd' : 'sh'
645-
const command = `npx vercel project rm ${vercelProjectName}`
653+
const command = `npx vercel@latest project rm ${vercelProjectName}`
646654
const args = process.platform === 'win32' ? ['/c', command] : ['-c', command]
647655

648656
const child = spawn(shell, args, { cwd: serverPath })

0 commit comments

Comments
 (0)