@@ -180,7 +180,6 @@ export async function deploy(
180180
181181 deployTarget ??= await promptDeployTarget ( effects , apiClient , config , currentUser ) ;
182182
183- const previousProjectId = deployConfig ?. projectId ;
184183 let targetDescription : string ;
185184 let buildFilePaths : string [ ] | null = null ;
186185 let doBuild = force === "build" ;
@@ -254,8 +253,7 @@ export async function deploy(
254253 // Check last deployed state. If it's not the same project, ask the user if
255254 // they want to continue anyways. In non-interactive mode just cancel.
256255 targetDescription = `${ deployTarget . project . title } (@${ deployTarget . workspace . login } /${ deployTarget . project . slug } )` ;
257- const previousProjectId = deployConfig . projectId ;
258- if ( previousProjectId && previousProjectId !== deployTarget . project . id ) {
256+ if ( deployConfig . projectId && deployConfig . projectId !== deployTarget . project . id ) {
259257 clack . log . warn (
260258 `The \`projectId\` in your deploy.json does not match. Continuing will overwrite ${ bold ( targetDescription ) } .`
261259 ) ;
@@ -274,7 +272,7 @@ export async function deploy(
274272 } else {
275273 throw new CliError ( "Cancelling deploy due to misconfiguration." ) ;
276274 }
277- } else if ( previousProjectId ) {
275+ } else if ( deployConfig . projectId ) {
278276 clack . log . info ( `Deploying to ${ bold ( targetDescription ) } .` ) ;
279277 } else {
280278 clack . log . warn (
@@ -296,6 +294,10 @@ export async function deploy(
296294 throw new CliError ( "Running non-interactively, cancelling due to conflictg" ) ;
297295 }
298296 }
297+
298+ if ( deployTarget . project . title !== config . title ) {
299+ projectUpdates . title = config . title ;
300+ }
299301 }
300302
301303 if ( message === undefined ) {
@@ -451,7 +453,7 @@ export async function deploy(
451453 if ( ! deployInfo ) throw new CliError ( "Deploy failed to process on server" ) ;
452454
453455 // Update project title if necessary
454- if ( previousProjectId && previousProjectId === deployTarget . project . id && typeof projectUpdates ?. title === "string" ) {
456+ if ( typeof projectUpdates ?. title === "string" ) {
455457 await apiClient . postEditProject ( deployTarget . project . id , projectUpdates as PostEditProjectRequest ) ;
456458 }
457459 clack . outro ( `Deployed project now visible at ${ link ( deployInfo . url ) } ` ) ;
0 commit comments