From a661907b40e76aa56e7d7bd7e745bb16456b13e7 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Tue, 21 Mar 2023 17:27:52 +0800 Subject: [PATCH] chore: wrap the projectDir in quotes if it contains spaces (#6594) * chore: wrap the projectDir in quotes if it contains spaces * chore: add changeset * fix: update output projectDir * Update .changeset/tall-beans-own.md Co-authored-by: Bjorn Lu --------- Co-authored-by: Bjorn Lu --- .changeset/tall-beans-own.md | 5 +++++ packages/create-astro/src/messages.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/tall-beans-own.md diff --git a/.changeset/tall-beans-own.md b/.changeset/tall-beans-own.md new file mode 100644 index 000000000000..6713c3e1907b --- /dev/null +++ b/.changeset/tall-beans-own.md @@ -0,0 +1,5 @@ +--- +'create-astro': patch +--- + +wrap projecDir in quptes if it contains spaces diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts index c0adbaa4a727..9121ad60f74c 100644 --- a/packages/create-astro/src/messages.ts +++ b/packages/create-astro/src/messages.ts @@ -121,9 +121,10 @@ export const nextSteps = async ({ projectDir, devCmd }: { projectDir: string; de await sleep(100); if (projectDir !== '') { + projectDir = projectDir.includes(' ') ? `"./${projectDir}"` : `./${projectDir}`; const enter = [ `\n${prefix}Enter your project directory using`, - color.cyan(`cd ./${projectDir}`, ''), + color.cyan(`cd ${projectDir}`, ''), ]; const len = enter[0].length + stripAnsi(enter[1]).length; log(enter.join(len > max ? '\n' + prefix : ' '));