docs: add root path to gitignore suggestion (#2488)

pull/2758/head
Lehoczky Zoltán 1 year ago committed by GitHub
parent c9d465587a
commit 819eb515d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -159,6 +159,7 @@ export function scaffold({
const dir = const dir =
root === './' ? `` : ` ${root.replace(/^\.\//, '').replace(/[/\\]$/, '')}` root === './' ? `` : ` ${root.replace(/^\.\//, '').replace(/[/\\]$/, '')}`
const gitignorePrefix = dir ? `${dir}/.vitepress` : '.vitepress'
const pkgPath = path.resolve('package.json') const pkgPath = path.resolve('package.json')
const userPkg = fs.existsSync(pkgPath) const userPkg = fs.existsSync(pkgPath)
@ -168,8 +169,9 @@ export function scaffold({
const tips = [] const tips = []
if (fs.existsSync('.git')) { if (fs.existsSync('.git')) {
tips.push( tips.push(
`Make sure to add ${cyan(`.vitepress/dist`)} and ` + `Make sure to add ${cyan(`${gitignorePrefix}/dist`)} and ` +
`${cyan(`.vitepress/cache`)} to your ${cyan(`.gitignore`)} file.` `${cyan(`${gitignorePrefix}/cache`)} to your ` +
`${cyan(`.gitignore`)} file.`
) )
} }
if ( if (

Loading…
Cancel
Save