Browse Source

修改编译错误

lilinsen 6 years ago
parent
commit
5a980cb37f
2 changed files with 17 additions and 5 deletions
  1. 1 0
      package.json
  2. 16 5
      scripts/mdToVue.js

+ 1 - 0
package.json

@@ -103,6 +103,7 @@
     "mocha": "5.2.0",
     "mocha-webpack": "2.0.0-beta.0",
     "moment": "2.22.2",
+    "node-filelist": "^1.0.0",
     "node-notifier": "5.2.1",
     "node-sass": "4.9.3",
     "nyc": "10.0.0",

+ 16 - 5
scripts/mdToVue.js

@@ -7,6 +7,7 @@ let marked = require('marked');
 if (!marked) {
     console.log('you need npm i marked -D!');
 }
+var nodeFilelist  = require('node-filelist');
 //文件监听
 let Chokidar = require('chokidar');
 // 基本配置文件信息
@@ -293,15 +294,25 @@ function fileDisplay(param) {
     comparehash(param.entry,(hashMsgObj)=>{
                 
         // 获取目录下所有文件
-        readDirRecur(param.entry, function(filePath) {    
-            //文件列表        
-            fileList.map(item=>{              
+        // readDirRecur(param.entry, function(filePath) {    
+        //     //文件列表        
+        //     fileList.map(item=>{              
+        //         ismd(item,hashMsgObj,res=>{
+        //             //res md文件处理结果           
+        //             createdFile(param.output + res.mdName + '.vue', res.html, param)
+        //         })
+        //     })    
+        // });
+        nodeFilelist.read([param.entry],{"ext":"md"},res=>{    
+            let reslength = res.length;    
+            let routers = [];            
+            res.map((item,index)=>{   //数组化文件   
                 ismd(item,hashMsgObj,res=>{
                     //res md文件处理结果           
                     createdFile(param.output + res.mdName + '.vue', res.html, param)
                 })
-            })    
-        });
+            })     
+        })
     });