From 2022b773414a34de05677c776f4f4324f43a54e2 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Wed, 1 Apr 2026 13:45:04 +0100 Subject: [PATCH] fix(create-emdash): use async exec so spinner animates during install --- .changeset/fix-create-emdash-spinner.md | 5 +++++ packages/create-emdash/src/index.ts | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .changeset/fix-create-emdash-spinner.md diff --git a/.changeset/fix-create-emdash-spinner.md b/.changeset/fix-create-emdash-spinner.md new file mode 100644 index 0000000..80b6f79 --- /dev/null +++ b/.changeset/fix-create-emdash-spinner.md @@ -0,0 +1,5 @@ +--- +"create-emdash": patch +--- + +Fix spinner hanging during dependency installation by using async exec instead of execSync, which was blocking the event loop and preventing the spinner animation from updating. diff --git a/packages/create-emdash/src/index.ts b/packages/create-emdash/src/index.ts index 51e27dc..07c21ed 100644 --- a/packages/create-emdash/src/index.ts +++ b/packages/create-emdash/src/index.ts @@ -6,9 +6,12 @@ * Usage: npm create emdash@latest */ -import { execSync } from "node:child_process"; +import { exec } from "node:child_process"; import { existsSync, readFileSync, writeFileSync } from "node:fs"; import { resolve } from "node:path"; +import { promisify } from "node:util"; + +const execAsync = promisify(exec); import * as p from "@clack/prompts"; import { downloadTemplate } from "giget"; @@ -251,10 +254,7 @@ async function main() { if (shouldInstall) { s.start(`Installing dependencies with ${pc.cyan(pm)}...`); try { - execSync(installCmd, { - cwd: projectDir, - stdio: "ignore", - }); + await execAsync(installCmd, { cwd: projectDir }); s.stop("Dependencies installed!"); } catch { s.stop("Failed to install dependencies");