From 5a4e770409e256d644ac2f544c52a917bc3428cf Mon Sep 17 00:00:00 2001 From: svirs <shur@sanity.io> Date: Mon, 30 Sep 2024 03:03:28 +0200 Subject: [PATCH] fix: move cliInitializedAt call higher in init flow --- .../cli/src/actions/init-project/initProject.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/@sanity/cli/src/actions/init-project/initProject.ts b/packages/@sanity/cli/src/actions/init-project/initProject.ts index fe87d5eb5dd1..78cd4104199a 100644 --- a/packages/@sanity/cli/src/actions/init-project/initProject.ts +++ b/packages/@sanity/cli/src/actions/init-project/initProject.ts @@ -594,11 +594,8 @@ export default async function initSanity( trace.log({step: 'importTemplateDataset', selectedOption: shouldImport ? 'yes' : 'no'}) - // Bootstrap Sanity, creating required project files, manifests etc - await bootstrapTemplate(templateOptions, context) - - // update that files were initialized locally; do not halt flow for request - apiClient({api: {projectId: projectId}}) + // record that template files attempted to be created locally + await apiClient({api: {projectId: projectId}}) .request<SanityProject>({uri: `/projects/${projectId}`}) .then((project: SanityProject) => { if (!project?.metadata?.cliInitializedAt) { @@ -615,6 +612,9 @@ export default async function initSanity( debug('Failed to update cliInitializedAt metadata') }) + // Bootstrap Sanity, creating required project files, manifests etc + await bootstrapTemplate(templateOptions, context) + let pkgManager: PackageManager // If the user has specified a package manager, and it's allowed use that