lilinsen 7 年 前
コミット
d41b58116d
1 ファイル変更18 行追加17 行削除
  1. 18 17
      scripts/mdToVue.js

+ 18 - 17
scripts/mdToVue.js

@@ -195,7 +195,9 @@ function checkIsexists (path,callback){
         }
         }
     }) 
     }) 
 }
 }
-
+/**
+ * 执行文件缓存
+ */
 let outhash = [];
 let outhash = [];
 function pushHash(obj){ 
 function pushHash(obj){ 
     //紧紧插入md文件hash                       
     //紧紧插入md文件hash                       
@@ -224,22 +226,21 @@ function comparehash(path,callback){
             folders: { exclude: ['.*', 'node_modules', 'test_coverage'] },
             folders: { exclude: ['.*', 'node_modules', 'test_coverage'] },
             files: { include: ['*.md'],exclude:['*.js','*.vue','*.scss','__test__'] }
             files: { include: ['*.md'],exclude:['*.js','*.vue','*.scss','__test__'] }
         }).then(hash => {           
         }).then(hash => {           
-                if(fileText){
-                    //如果有内容
-                    callback({
-                        fileText:fileText,
-                        cachePath:cachePath
-                    })
-                }else{
-                    pushHash(hash)
-                    console.log(outhash)
-                    fs.writeFileSync(cachePath,outhash.join('|'),'utf-8');
-                    //如果没有内容
-                    callback({
-                        fileText:fileText,
-                        cachePath:cachePath
-                    })
-                }
+            if(fileText){
+                //如果有内容
+                callback({
+                    fileText:fileText,
+                    cachePath:cachePath
+                })
+            }else{
+                pushHash(hash)               
+                fs.writeFileSync(cachePath,outhash.join('|'),'utf-8');
+                //如果没有内容
+                callback({
+                    fileText:fileText,
+                    cachePath:cachePath
+                })
+            }
         })
         })
         .catch(error => {
         .catch(error => {
             return console.error('hashing failed:', error);
             return console.error('hashing failed:', error);