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

Commit

Permalink
fix: show up an appropriate warning if the target path exists and is …
Browse files Browse the repository at this point in the history
…non-empty (#570)
  • Loading branch information
jamesgeorge007 authored Jul 27, 2020
1 parent 80f8137 commit 21d6729
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/create-nuxt-app/lib/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
const path = require('path')
const fs = require('fs')
const sao = require('sao')
const cac = require('cac')
const chalk = require('chalk')
Expand Down Expand Up @@ -33,8 +34,12 @@ cli
if (cliOptions.info) {
return showEnvInfo()
}
const files = fs.existsSync(outDir) ? fs.readdirSync(outDir) : []
console.log()
console.log(chalk`{cyan create-nuxt-app v${version}}`)
if (files.length) {
return console.log(chalk.red(`Can't create ${outDir} because there's already a non-empty directory ${outDir} existing in path.`))
}
console.log(chalk`✨ Generating Nuxt.js project in {cyan ${outDir}}`)

const { verbose, answers } = cliOptions
Expand Down

0 comments on commit 21d6729

Please sign in to comment.