File tree Expand file tree Collapse file tree
packages/database/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,17 +108,22 @@ const makeBranchEnv = async (vercel: Vercel, vercelToken: string) => {
108108} ;
109109
110110const makeProductionEnv = async ( vercel : Vercel , vercelToken : string ) => {
111- const result = await vercel . deployments . getDeployments ( {
111+ const result = await vercel . projects . getProjectDomains ( {
112112 ...baseParams ,
113- projectId : projectIdOrName ,
114- limit : 1 ,
115- target : "production" ,
116- state : "READY" ,
113+ idOrName : projectIdOrName ,
114+ production : "true" ,
117115 } ) ;
118- if ( result . deployments . length == 0 ) {
119- throw new Error ( "No production deployment found" ) ;
116+ const domains = result . domains . filter (
117+ ( d ) => ! d . redirect && d . apexName . indexOf ( "vercel" ) < 0 ,
118+ ) ;
119+ if ( domains . length === 0 ) {
120+ throw new Error ( "No production domains found" ) ;
121+ }
122+ if ( domains . length > 1 ) {
123+ console . log ( domains ) ;
124+ throw new Error ( "Too many production domains found" ) ;
120125 }
121- const url = result . deployments [ 0 ] ! . url ;
126+ const url = domains [ 0 ] ! . name ;
122127 execSync (
123128 `vercel -t ${ vercelToken } env pull --environment production .env.production` ,
124129 ) ;
You can’t perform that action at this time.
0 commit comments