lilinsen 6 年之前
父节点
当前提交
a38f5c8916
共有 1 个文件被更改,包括 3 次插入46 次删除
  1. 3 46
      scripts/mdToVue.js

+ 3 - 46
scripts/mdToVue.js

@@ -262,8 +262,7 @@ function comparehash(path,callback){
         .catch(error => {
             return console.error('hashing failed:', error);
         }); 
-    })
-     
+    })     
 }
 //文件监听
 function filelisten(param){  
@@ -291,18 +290,7 @@ function filelisten(param){
  */
 function fileDisplay(param) {
     //检查文件是否第一次初始化并获取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=>{    
             let reslength = res.length;    
             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} 文件读取路径