From 3be7180b731480b01fa4e2df5450a1b0002287bb Mon Sep 17 00:00:00 2001 From: jesse Date: Mon, 4 Sep 2023 16:23:49 +0800 Subject: [PATCH 1/3] fix: remove duplicate import --- benchmark/bench/render.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/benchmark/bench/render.js b/benchmark/bench/render.js index 8b0e30ad7295..ac733bdeaa61 100644 --- a/benchmark/bench/render.js +++ b/benchmark/bench/render.js @@ -5,9 +5,8 @@ import http from 'node:http'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { waitUntilBusy } from 'port-authority'; -import { calculateStat } from './_util.js'; +import { calculateStat, astroBin } from './_util.js'; import { renderFiles } from '../make-project/render-default.js'; -import { astroBin } from './_util.js'; const port = 4322; From dfadc6b29cd7bc7db754cb3d964123c3e48e6be4 Mon Sep 17 00:00:00 2001 From: jesse Date: Wed, 6 Sep 2023 19:55:17 +0800 Subject: [PATCH 2/3] project name should be trimed --- packages/create-astro/src/actions/project-name.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-astro/src/actions/project-name.ts b/packages/create-astro/src/actions/project-name.ts index 943de91bf57c..b7099d9bbbed 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 Date: Wed, 6 Sep 2023 20:00:47 +0800 Subject: [PATCH 3/3] update changeset --- .changeset/eighty-gifts-speak.md | 5 +++++ packages/create-astro/test/project-name.test.js | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 .changeset/eighty-gifts-speak.md diff --git a/.changeset/eighty-gifts-speak.md b/.changeset/eighty-gifts-speak.md new file mode 100644 index 000000000000..38f64ac002f4 --- /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/test/project-name.test.js b/packages/create-astro/test/project-name.test.js index f297da076009..a78207369036 100644 --- a/packages/create-astro/test/project-name.test.js +++ b/packages/create-astro/test/project-name.test.js @@ -62,6 +62,15 @@ describe('project name', () => { 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);