From 8d38144f98db9d993ebcedaf43b68f5e395d00bf Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 10 Oct 2025 05:38:48 +0100 Subject: [PATCH] deps first --- packages/cli/src/commands/init.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index fe509a1..b37c047 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -47,22 +47,7 @@ export async function initCommand(): Promise { const externalsTspPath = resolve(typelexDir, "externals.tsp"); console.log("Initializing typelex project...\n"); - - // Prompt for namespace - let namespace = await promptNamespace(); - - // Validate namespace format - while (!namespace.endsWith(".*")) { - console.error(`Error: namespace must end with .*`); - console.error(`Got: ${namespace}\n`); - namespace = await promptNamespace(); - } - - // Remove the .* suffix for use in template - const namespacePrefix = namespace.slice(0, -2); - - // Install dependencies first - console.log("\nInstalling dependencies...\n"); + console.log("Installing dependencies...\n"); // Detect package manager let packageManager = "npm"; @@ -105,6 +90,19 @@ export async function initCommand(): Promise { }); }); + // Prompt for namespace after successful installation + let namespace = await promptNamespace(); + + // Validate namespace format + while (!namespace.endsWith(".*")) { + console.error(`Error: namespace must end with .*`); + console.error(`Got: ${namespace}\n`); + namespace = await promptNamespace(); + } + + // Remove the .* suffix for use in template + const namespacePrefix = namespace.slice(0, -2); + // Create typelex directory await mkdir(typelexDir, { recursive: true }); -- 2.51.2