tasks/jsdoc-template/publish.js
function(src, dest) {
    var contents,
        srcExists = fs.existsSync(src),
        destExists = fs.existsSync(dest),
        stats = srcExists && fs.statSync(src),
        isDirectory = srcExists && stats.isDirectory();

    if (srcExists) {
        if (isDirectory) {
            if (!destExists) {
                fs.mkdirSync(dest);
            }
            fs.readdirSync(src).forEach(function(childItemName) {
                copyRecursiveSync(path.join(src, childItemName),
                    path.join(dest, childItemName));
            });
        } else {
            contents = fs.readFileSync(src);
            fs.writeFileSync(dest, contents);
        }
    }
}
function(src, dest) {
    var contents,
        srcExists = fs.existsSync(src),
        destExists = fs.existsSync(dest),
        stats = srcExists && fs.statSync(src),
        isDirectory = srcExists && stats.isDirectory();

    if (srcExists) {
        if (isDirectory) {
            if (!destExists) {
                fs.mkdirSync(dest);
            }
            fs.readdirSync(src).forEach(function(childItemName) {
                copyRecursiveSync(path.join(src, childItemName),
                    path.join(dest, childItemName));
            });
        } else {
            contents = fs.readFileSync(src);
            fs.writeFileSync(dest, contents);
        }
    }
}
function ( src , dest ) { var contents , srcExists = fs . existsSync ( src ) , destExists = fs . existsSync ( dest ) , stats = srcExists && fs . statSync ( src ) , isDirectory = srcExists && stats . isDirectory ( ) ; if ( srcExists ) { if ( isDirectory ) { if ( ! destExists ) { fs . mkdirSync ( dest ) ; } fs . readdirSync ( src ) . forEach ( function ( childItemName ) { copyRecursiveSync ( path . join ( src , childItemName ) , path . join ( dest , childItemName ) ) ; } ) ; } else { contents = fs . readFileSync ( src ) ; fs . writeFileSync ( dest , contents ) ; } } }
Look ma, it's cp -R.
@param {string} src The path to the thing to copy.
@param {string} dest The path to the new copy.
Look ma it s cp - R .