function checkRootDir() {
        return fs.pathExists(rootDirPath)
            .then(exists => {
                if (!exists) {
                    // throw new Error(chalk.red(`Target directory does not exist: '${rootDirPath}'`));
                    return fs.ensureDir(rootDirPath).then(() => rootDirPath);
                }
                return fs.lstat(rootDirPath)
                    .then(stats => {
                        if (!stats.isDirectory()) {
                            throw new Error(chalk.red(`Target path is not a directory: '${rootDirPath}'\n`));
                        }
                        return utils.fs.isEmptyDir(rootDirPath);
                    })
                    .then(empty => {
                        if (!empty) {
                            throw new Error(chalk.yellow(`Target directory is not empty: '${rootDirPath}'\n`));
                        }
                        return rootDirPath;
                    });
            });
    }
function checkRootDir() {
        return fs.pathExists(rootDirPath)
            .then(exists => {
                if (!exists) {
                    
                    return fs.ensureDir(rootDirPath).then(() => rootDirPath);
                }
                return fs.lstat(rootDirPath)
                    .then(stats => {
                        if (!stats.isDirectory()) {
                            throw new Error(chalk.red(`Target path is not a directory: '${rootDirPath}'\n`));
                        }
                        return utils.fs.isEmptyDir(rootDirPath);
                    })
                    .then(empty => {
                        if (!empty) {
                            throw new Error(chalk.yellow(`Target directory is not empty: '${rootDirPath}'\n`));
                        }
                        return rootDirPath;
                    });
            });
    }
function checkRootDir ( ) { return fs . pathExists ( rootDirPath ) . then ( exists => { if ( ! exists ) { // throw new Error(chalk.red(`Target directory does not exist: '${rootDirPath}'`)); return fs . ensureDir ( rootDirPath ) . then ( ( ) => rootDirPath ) ; } return fs . lstat ( rootDirPath ) . then ( stats => { if ( ! stats . isDirectory ( ) ) { throw new Error ( chalk . red ( ` ${ rootDirPath } \n ` ) ) ; } return utils . fs . isEmptyDir ( rootDirPath ) ; } ) . then ( empty => { if ( ! empty ) { throw new Error ( chalk . yellow ( ` ${ rootDirPath } \n ` ) ) ; } return rootDirPath ; } ) ; } ) ; }
-------------------------------- HELPER METHODS --------------------------------
-------------------------------- HELPER METHODS --------------------------------