@@ -594,26 +594,31 @@ export default async function initSanity(
594
594
595
595
trace . log ( { step : 'importTemplateDataset' , selectedOption : shouldImport ? 'yes' : 'no' } )
596
596
597
- // Bootstrap Sanity, creating required project files, manifests etc
598
- await bootstrapTemplate ( templateOptions , context )
599
-
600
- // update that files were initialized locally; do not halt flow for request
601
- apiClient ( { api : { projectId : projectId } } )
602
- . request < SanityProject > ( { uri : `/projects/${ projectId } ` } )
603
- . then ( ( project : SanityProject ) => {
604
- if ( ! project ?. metadata ?. cliInitializedAt ) {
605
- return apiClient ( { api : { projectId} } ) . request ( {
606
- method : 'PATCH' ,
607
- uri : `/projects/${ projectId } ` ,
608
- body : { metadata : { cliInitializedAt : new Date ( ) . toISOString ( ) } } ,
609
- } )
610
- }
611
- return Promise . resolve ( )
612
- } )
613
- . catch ( ( ) => {
614
- // Non-critical update
615
- debug ( 'Failed to update cliInitializedAt metadata' )
616
- } )
597
+ const [ _ , bootstrapPromise ] = await Promise . allSettled ( [
598
+ // record template files attempted to be created locally
599
+ apiClient ( { api : { projectId : projectId } } )
600
+ . request < SanityProject > ( { uri : `/projects/${ projectId } ` } )
601
+ . then ( ( project : SanityProject ) => {
602
+ if ( ! project ?. metadata ?. cliInitializedAt ) {
603
+ return apiClient ( { api : { projectId} } ) . request ( {
604
+ method : 'PATCH' ,
605
+ uri : `/projects/${ projectId } ` ,
606
+ body : { metadata : { cliInitializedAt : new Date ( ) . toISOString ( ) } } ,
607
+ } )
608
+ }
609
+ return Promise . resolve ( )
610
+ } )
611
+ . catch ( ( ) => {
612
+ // Non-critical update
613
+ debug ( 'Failed to update cliInitializedAt metadata' )
614
+ } ) ,
615
+ // Bootstrap Sanity, creating required project files, manifests etc
616
+ bootstrapTemplate ( templateOptions , context ) ,
617
+ ] )
618
+
619
+ if ( bootstrapPromise . status === 'rejected' && bootstrapPromise . reason instanceof Error ) {
620
+ throw bootstrapPromise . reason
621
+ }
617
622
618
623
let pkgManager : PackageManager
619
624
0 commit comments