Skip to content

Commit

Permalink
fix(create-vite): allow slash at the end of project path (#6897)
Browse files Browse the repository at this point in the history
  • Loading branch information
Olyno committed May 9, 2022
1 parent d7c04e8 commit 8167db3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/create-vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ async function init() {
let targetDir = argv._[0]
let template = argv.template || argv.t

const defaultProjectName = !targetDir ? 'vite-project' : targetDir
const defaultProjectName = !targetDir
? 'vite-project'
: targetDir.trim().replace(/\/+$/g, '')

let result = {}

Expand All @@ -145,7 +147,8 @@ async function init() {
message: reset('Project name:'),
initial: defaultProjectName,
onState: (state) =>
(targetDir = state.value.trim() || defaultProjectName)
(targetDir =
state.value.trim().replace(/\/+$/g, '') || defaultProjectName)
},
{
type: () =>
Expand Down

0 comments on commit 8167db3

Please sign in to comment.