Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lilinsen committed Jan 24, 2019
1 parent e2a6e60 commit d41b581
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions scripts/mdToVue.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ function checkIsexists (path,callback){
}
})
}

/**
* 执行文件缓存
*/
let outhash = [];
function pushHash(obj){
//紧紧插入md文件hash
Expand Down Expand Up @@ -224,22 +226,21 @@ function comparehash(path,callback){
folders: { exclude: ['.*', 'node_modules', 'test_coverage'] },
files: { include: ['*.md'],exclude:['*.js','*.vue','*.scss','__test__'] }
}).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 => {
return console.error('hashing failed:', error);
Expand Down

0 comments on commit d41b581

Please sign in to comment.