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 <bjornlu.dev@gmail.com>

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
This commit is contained in:
btea 2023-03-21 17:27:52 +08:00 committed by GitHub
parent f112c12b15
commit a661907b40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'create-astro': patch
---
wrap projecDir in quptes if it contains spaces

View file

@ -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 : ' '));