Skip to content

Commit

Permalink
fix(init): better messages when files/folders already exists (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
sushantdhiman committed Nov 27, 2017
1 parent 0fe8643 commit 6c6fc82
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/helpers/init-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';
import fs from 'fs';

function createFolder (folderName, folder, force) {
if (force) {
if (force && fs.existsSync(folder) === true) {
helpers.view.log('Deleting the ' + folderName + ' folder. (--force)');

try {
Expand All @@ -23,8 +23,12 @@ function createFolder (folderName, folder, force) {
}

try {
helpers.asset.mkdirp(folder);
helpers.view.log('Successfully created ' + folderName + ' folder at "' + folder + '".');
if (fs.existsSync(folder) === false) {
helpers.asset.mkdirp(folder);
helpers.view.log('Successfully created ' + folderName + ' folder at "' + folder + '".');
} else {
helpers.view.log(folderName + ' folder at "' + folder + '" already exists.');
}
} catch (e) {
helpers.view.error(e);
}
Expand Down

0 comments on commit 6c6fc82

Please sign in to comment.