Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 8186168

Browse files
fix(cli): rephrase not empty directory error message (#778)
1 parent 58dd146 commit 8186168

File tree

1 file changed

+6
-3
lines changed
  • packages/create-nuxt-app/lib

1 file changed

+6
-3
lines changed

packages/create-nuxt-app/lib/cli.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ cli
3434
if (cliOptions.info) {
3535
return showEnvInfo()
3636
}
37-
const files = fs.existsSync(outDir) ? fs.readdirSync(outDir) : []
3837
console.log()
3938
console.log(chalk`{cyan create-nuxt-app v${version}}`)
40-
if (files.length) {
41-
return console.log(chalk.red(`Can't create ${outDir} because there's already a non-empty directory ${outDir} existing in path.`))
39+
40+
if (fs.existsSync(outDir) && fs.readdirSync(outDir).length) {
41+
const baseDir = outDir === '.' ? path.basename(process.cwd()) : outDir
42+
return console.error(chalk.red(
43+
`Could not create project in ${chalk.bold(baseDir)} because the directory is not empty.`))
4244
}
45+
4346
console.log(chalk`✨ Generating Nuxt.js project in {cyan ${outDir}}`)
4447

4548
const { verbose, answers } = cliOptions

0 commit comments

Comments
 (0)