lib/init.js
function isInEmptyFolder() {
    var files = FS.readdirSync( '.' );
    try {
        if ( files.length == 0 ) return true;
        console.log( Fatal.format(
            "You should be in an empty folder to create a new project!\n" +
            "If you continue, all the files in this folder will be DELETED!"
        ) );
        console.log( "\nWe suggest that you create an fresh new directory, like this:" );
        console.log( "\n> " + "mkdir my-project-folder".yellow.italic );
        console.log( "> " + "cd my-project-folder".yellow.italic );
        console.log( "> " + "tfw init".yellow.italic );
        return false;
    } catch ( ex ) {
        fatal( "Fatal error in function `files`!\n" + JSON.stringify( ex, null, '  ' ) );
    }
}
function isInEmptyFolder() {
    var files = FS.readdirSync( '.' );
    try {
        if ( files.length == 0 ) return true;
        console.log( Fatal.format(
            "You should be in an empty folder to create a new project!\n" +
            "If you continue, all the files in this folder will be DELETED!"
        ) );
        console.log( "\nWe suggest that you create an fresh new directory, like this:" );
        console.log( "\n> " + "mkdir my-project-folder".yellow.italic );
        console.log( "> " + "cd my-project-folder".yellow.italic );
        console.log( "> " + "tfw init".yellow.italic );
        return false;
    } catch ( ex ) {
        fatal( "Fatal error in function `files`!\n" + JSON.stringify( ex, null, '  ' ) );
    }
}
function isInEmptyFolder ( ) { var files = FS . readdirSync ( '.' ) ; try { if ( files . length == 0 ) return true ; console . log ( Fatal . format ( "You should be in an empty folder to create a new project!\n" + "If you continue, all the files in this folder will be DELETED!" ) ) ; console . log ( "\nWe suggest that you create an fresh new directory, like this:" ) ; console . log ( "\n> " + "mkdir my-project-folder" . yellow . italic ) ; console . log ( "> " + "cd my-project-folder" . yellow . italic ) ; console . log ( "> " + "tfw init" . yellow . italic ) ; return false ; } catch ( ex ) { fatal ( "Fatal error in function `files`!\n" + JSON . stringify ( ex , null , '  ' ) ) ; } }
Check if we are in an empty folder.
Check if we are in an empty folder .