node 怎么自己写node

2020-07-17 社会 77阅读
您好:
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;
}
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com