lib/utils/fs.js
function cleanFolder(root) {
    if (!fs.existsSync(root)) return fsUtils.mkdirp(root);

    return listFiles(root, {
        ignoreFiles: [],
        ignoreRules: [
            // Skip Git and SVN stuff
            '.git/',
            '.svn/'
        ]
    })
    .then(function(files) {
        var d = Q.defer();

        _.reduce(files, function(prev, file, i) {
            return prev.then(function() {
                var _file = path.join(root, file);

                d.notify({
                    i: i+1,
                    count: files.length,
                    file: _file
                });
                return fsUtils.remove(_file);
            });
        }, Q())
        .then(function() {
            d.resolve();
        }, function(err) {
            d.reject(err);
        });

        return d.promise;
    });
}
function cleanFolder(root) {
    if (!fs.existsSync(root)) return fsUtils.mkdirp(root);

    return listFiles(root, {
        ignoreFiles: [],
        ignoreRules: [
            // Skip Git and SVN stuff
            '.git/',
            '.svn/'
        ]
    })
    .then(function(files) {
        var d = Q.defer();

        _.reduce(files, function(prev, file, i) {
            return prev.then(function() {
                var _file = path.join(root, file);

                d.notify({
                    i: i+1,
                    count: files.length,
                    file: _file
                });
                return fsUtils.remove(_file);
            });
        }, Q())
        .then(function() {
            d.resolve();
        }, function(err) {
            d.reject(err);
        });

        return d.promise;
    });
}
function cleanFolder ( root ) { if ( ! fs . existsSync ( root ) ) return fsUtils . mkdirp ( root ) ; return listFiles ( root , { ignoreFiles : [ ] , ignoreRules : [ // Skip Git and SVN stuff '.git/' , '.svn/' ] } ) . then ( function ( files ) { var d = Q . defer ( ) ; _ . reduce ( files , function ( prev , file , i ) { return prev . then ( function ( ) { var _file = path . join ( root , file ) ; d . notify ( { i : i + 1 , count : files . length , file : _file } ) ; return fsUtils . remove ( _file ) ; } ) ; } , Q ( ) ) . then ( function ( ) { d . resolve ( ) ; } , function ( err ) { d . reject ( err ) ; } ) ; return d . promise ; } ) ; }
Clean a folder without removing .git and .svn Creates it if non existant
Clean a folder without removing . git and . svn Creates it if non existant