pull/3640/merge
Timothy Lau 9 months ago committed by GitHub
commit 13791c03c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -43,9 +43,17 @@ export async function init(root: string | undefined) {
return text({
message: 'Where should VitePress initialize the config?',
defaultValue: './',
initialValue: './',
validate(value) {
// TODO make sure directory is inside
const inputRoot = path.resolve(value)
const currentRoot = path.resolve()
if (!inputRoot.startsWith(currentRoot)) {
return 'Please make sure directory is inside'
}
if (inputRoot != currentRoot && fs.pathExistsSync(inputRoot)) {
return `${value} already exists`
}
}
})
},

Loading…
Cancel
Save