update prepublish process

This commit is contained in:
jiaming743
2019-07-03 18:56:55 +08:00
parent bfc7cc7c57
commit 3fb3936aa9
3 changed files with 32 additions and 8 deletions

View File

@ -281,6 +281,20 @@ async function fileForEach (src, callback) {
return true
}
async function readFile (src, encoding = 'utf8') {
return new Promise(resolve => {
fs.readFile(src, encoding, (err, data) => {
if (err) {
console.warn(err)
resolve(false)
} else {
resolve(data)
}
})
})
}
module.exports = {
readDir,
stat,
@ -289,5 +303,6 @@ module.exports = {
emptyDir,
unlinkDirFileByExtname,
copyDir,
fileForEach
fileForEach,
readFile
}

View File

@ -16,6 +16,4 @@ const print = {
}
}
module.exports = {
print
}
module.exports = print