@@ -112,9 +112,11 @@ function errIsStartupErr(err: unknown): err is ParseError & { code: 10021 } {
112
112
return false ;
113
113
}
114
114
115
- export default async function versionsUpload (
116
- props : Props
117
- ) : Promise < { versionId : string | null ; workerTag : string | null } > {
115
+ export default async function versionsUpload ( props : Props ) : Promise < {
116
+ versionId : string | null ;
117
+ workerTag : string | null ;
118
+ versionPreviewUrl ?: string | undefined ;
119
+ } > {
118
120
// TODO: warn if git/hg has uncommitted changes
119
121
const { config, accountId, name } = props ;
120
122
let versionId : string | null = null ;
@@ -565,6 +567,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
565
567
logger . log ( "Uploaded" , workerName , formatTime ( uploadMs ) ) ;
566
568
logger . log ( "Worker Version ID:" , versionId ) ;
567
569
570
+ let versionPreviewUrl : string | undefined = undefined ;
571
+
568
572
if ( versionId && hasPreview ) {
569
573
const { enabled : available_on_subdomain } = await fetchResult < {
570
574
enabled : boolean ;
@@ -573,9 +577,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
573
577
if ( available_on_subdomain ) {
574
578
const userSubdomain = await getWorkersDevSubdomain ( accountId ) ;
575
579
const shortVersion = versionId . slice ( 0 , 8 ) ;
576
- logger . log (
577
- `Version Preview URL: https://${ shortVersion } -${ workerName } .${ userSubdomain } .workers.dev`
578
- ) ;
580
+ versionPreviewUrl = `https://${ shortVersion } -${ workerName } .${ userSubdomain } .workers.dev` ;
581
+ logger . log ( `Version Preview URL: ${ versionPreviewUrl } ` ) ;
579
582
}
580
583
}
581
584
@@ -591,7 +594,7 @@ Changes to triggers (routes, custom domains, cron schedules, etc) must be applie
591
594
` )
592
595
) ;
593
596
594
- return { versionId, workerTag } ;
597
+ return { versionId, workerTag, versionPreviewUrl } ;
595
598
}
596
599
597
600
function helpIfErrorIsSizeOrScriptStartup (
0 commit comments