|
@@ -262,8 +262,7 @@ function comparehash(path,callback){
|
|
|
.catch(error => {
|
|
.catch(error => {
|
|
|
return console.error('hashing failed:', error);
|
|
return console.error('hashing failed:', error);
|
|
|
});
|
|
});
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
//文件监听
|
|
//文件监听
|
|
|
function filelisten(param){
|
|
function filelisten(param){
|
|
@@ -291,18 +290,7 @@ function filelisten(param){
|
|
|
*/
|
|
*/
|
|
|
function fileDisplay(param) {
|
|
function fileDisplay(param) {
|
|
|
//检查文件是否第一次初始化并获取hash
|
|
//检查文件是否第一次初始化并获取hash
|
|
|
- comparehash(param.entry,(hashMsgObj)=>{
|
|
|
|
|
-
|
|
|
|
|
- // 获取目录下所有文件
|
|
|
|
|
- // readDirRecur(param.entry, function(filePath) {
|
|
|
|
|
- // //文件列表
|
|
|
|
|
- // fileList.map(item=>{
|
|
|
|
|
- // ismd(item,hashMsgObj,res=>{
|
|
|
|
|
- // //res md文件处理结果
|
|
|
|
|
- // createdFile(param.output + res.mdName + '.vue', res.html, param)
|
|
|
|
|
- // })
|
|
|
|
|
- // })
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ comparehash(param.entry,(hashMsgObj)=>{
|
|
|
nodeFilelist.read([param.entry],{"ext":"md"},res=>{
|
|
nodeFilelist.read([param.entry],{"ext":"md"},res=>{
|
|
|
let reslength = res.length;
|
|
let reslength = res.length;
|
|
|
let routers = [];
|
|
let routers = [];
|
|
@@ -313,9 +301,7 @@ function fileDisplay(param) {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -337,35 +323,6 @@ function ishasOutFile(outPath,callback){
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-// function checkLoacl(){
|
|
|
|
|
-// var selfFile = './scripts/mdToVue.js';
|
|
|
|
|
-// //获取文件内容
|
|
|
|
|
-
|
|
|
|
|
-// checkIsexists(selfFile,(fileName)=>{
|
|
|
|
|
-// let fileText = fs.readFileSync(fileName,'utf-8');
|
|
|
|
|
-// })
|
|
|
|
|
-// //检查本文件是否被改动
|
|
|
|
|
-// hashElement('./scripts/mdToVue.js').then(hash => {
|
|
|
|
|
-// if(fileText){
|
|
|
|
|
-// //如果有内容
|
|
|
|
|
-// callback({
|
|
|
|
|
-// fileText:fileText,
|
|
|
|
|
-// cachePath:cachePath
|
|
|
|
|
-// })
|
|
|
|
|
-// }else{
|
|
|
|
|
-// pushHash(hash)
|
|
|
|
|
-// fs.writeFileSync(cachePath,outhash.join('|'),'utf-8');
|
|
|
|
|
-// //如果没有内容
|
|
|
|
|
-// callback({
|
|
|
|
|
-// fileText:fileText,
|
|
|
|
|
-// cachePath:cachePath
|
|
|
|
|
-// })
|
|
|
|
|
-// }
|
|
|
|
|
-// })
|
|
|
|
|
-// .catch(error => {
|
|
|
|
|
-// return console.error('hashing failed:', error);
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
|
* @param {entry} 文件读取路径
|
|
* @param {entry} 文件读取路径
|