您好:
var traceur = require('traceur');
var rocore = require('rocore');
var fs = require('fs');
var path = require('path');
var source = '/home/king/box-fork/dist';
var target = '/home/king/box-fork-compile';
rocore.readSync([source], 0, function (type, pathname) {
var newPath = path.join(target, pathname.replace(new RegExp('^' + source.replace(/\//g,'\/').replace(/\\/g,'\\')), ''));
if (type === 'file') {
if (path.extname(pathname) !== '.js') {
console.log('copy %s %s', pathname, newPath);
fs.writeFileSync(newPath, fs.readFileSync(pathname));
return;
}