diff --git a/.changeset/eighty-gifts-speak.md b/.changeset/eighty-gifts-speak.md new file mode 100644 index 000000000..38f64ac00 --- /dev/null +++ b/.changeset/eighty-gifts-speak.md @@ -0,0 +1,5 @@ +--- +'create-astro': patch +--- + +trim project name of the user input diff --git a/packages/create-astro/src/actions/project-name.ts b/packages/create-astro/src/actions/project-name.ts index 943de91bf..b7099d9bb 100644 --- a/packages/create-astro/src/actions/project-name.ts +++ b/packages/create-astro/src/actions/project-name.ts @@ -31,7 +31,7 @@ export async function projectName(ctx: Pick { expect(context.projectName).to.eq('foobar'); }); + + it('blank space', async () => { + const context = { projectName: '', cwd: '', prompt: () => ({ name: 'foobar ' }) }; + await projectName(context); + + expect(context.cwd).to.eq('foobar'); + expect(context.projectName).to.eq('foobar'); + }); + it('normalize', async () => { const context = { projectName: '', cwd: '', prompt: () => ({ name: 'Invalid Name' }) }; await projectName(context);