diff --git a/src/node/init/init.ts b/src/node/init/init.ts index d8d1dd61..1197c7f9 100644 --- a/src/node/init/init.ts +++ b/src/node/init/init.ts @@ -44,6 +44,7 @@ export async function init() { root: () => text({ message: 'Where should VitePress initialize the config?', + defaultValue: './', initialValue: './', validate(value) { const inputRoot = path.resolve(value) @@ -51,7 +52,7 @@ export async function init() { if (!inputRoot.startsWith(currentRoot)) { return 'Please make sure directory is inside' } - if (fs.pathExistsSync(inputRoot)) { + if (inputRoot != currentRoot && fs.pathExistsSync(inputRoot)) { return `${value} already exists` } }