From d32abe40da7ac27625dde62df2f55242fb4f38ed Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:58:25 +0000 Subject: [PATCH] feat: Get live URL from wrangler output Dynamically parse the live URL from the `wrangler deploy` command output instead of relying on a hardcoded `.workers.dev` domain. This makes the deployment script more robust and reliable. --- scripts/deploy.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index 556895c..4cd6b40 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -27,6 +27,19 @@ function execCommand(command, description) { } } +function execCommandWithOutput(command, description) { + console.log(`\nšŸ”„ ${description}...`) + try { + const output = execSync(command, { encoding: 'utf-8' }) + console.log(output) + console.log(`āœ… ${description} completed`) + return output + } catch (error) { + console.error(`āŒ ${description} failed:`, error.message) + process.exit(1) + } +} + function getAvailableSites() { const tomlDir = 'toml' if (!existsSync(tomlDir)) { @@ -114,10 +127,13 @@ async function deploy() { execCommand('npm run build', 'Building project') // Deploy Cloudflare Worker - execCommand(`wrangler deploy`, `Deploying Cloudflare Worker (${projectName})`) + const deployOutput = execCommandWithOutput(`wrangler deploy`, `Deploying Cloudflare Worker (${projectName})`) + + const urlMatch = deployOutput.match(/https?:\/\/[^\s]+/) + const liveUrl = urlMatch ? urlMatch[0] : `https://${projectName}.workers.dev` console.log('\nšŸŽ‰ Deployment completed successfully!') - console.log(`\nšŸ’” Your changes are now live at: https://${projectName}.workers.dev`) + console.log(`\nšŸ’” Your changes are now live at: ${liveUrl}`) process.exit(0) }