@@ -180,7 +180,6 @@ export async function deploy(
180
180
181
181
deployTarget ??= await promptDeployTarget ( effects , apiClient , config , currentUser ) ;
182
182
183
- const previousProjectId = deployConfig ?. projectId ;
184
183
let targetDescription : string ;
185
184
let buildFilePaths : string [ ] | null = null ;
186
185
let doBuild = force === "build" ;
@@ -254,8 +253,7 @@ export async function deploy(
254
253
// Check last deployed state. If it's not the same project, ask the user if
255
254
// they want to continue anyways. In non-interactive mode just cancel.
256
255
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 ) {
259
257
clack . log . warn (
260
258
`The \`projectId\` in your deploy.json does not match. Continuing will overwrite ${ bold ( targetDescription ) } .`
261
259
) ;
@@ -274,7 +272,7 @@ export async function deploy(
274
272
} else {
275
273
throw new CliError ( "Cancelling deploy due to misconfiguration." ) ;
276
274
}
277
- } else if ( previousProjectId ) {
275
+ } else if ( deployConfig . projectId ) {
278
276
clack . log . info ( `Deploying to ${ bold ( targetDescription ) } .` ) ;
279
277
} else {
280
278
clack . log . warn (
@@ -296,6 +294,10 @@ export async function deploy(
296
294
throw new CliError ( "Running non-interactively, cancelling due to conflictg" ) ;
297
295
}
298
296
}
297
+
298
+ if ( deployTarget . project . title !== config . title ) {
299
+ projectUpdates . title = config . title ;
300
+ }
299
301
}
300
302
301
303
if ( message === undefined ) {
@@ -451,7 +453,7 @@ export async function deploy(
451
453
if ( ! deployInfo ) throw new CliError ( "Deploy failed to process on server" ) ;
452
454
453
455
// Update project title if necessary
454
- if ( previousProjectId && previousProjectId === deployTarget . project . id && typeof projectUpdates ?. title === "string" ) {
456
+ if ( typeof projectUpdates ?. title === "string" ) {
455
457
await apiClient . postEditProject ( deployTarget . project . id , projectUpdates as PostEditProjectRequest ) ;
456
458
}
457
459
clack . outro ( `Deployed project now visible at ${ link ( deployInfo . url ) } ` ) ;
0 commit comments