mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
fix blog builder
This commit is contained in:
parent
1bd690c08a
commit
2b6af02d8e
1 changed files with 16 additions and 12 deletions
10
build.js
10
build.js
|
|
@ -45,9 +45,14 @@ function main() {
|
|||
function buildProject(name, project, ctx) {
|
||||
var dir = path.join(__dirname, 'proj', name)
|
||||
, index = path.join(dir, 'index.html')
|
||||
|
||||
try {
|
||||
fs.statSync(dir)
|
||||
fs.mkdir(dir, 0775, function(err) {
|
||||
if (err && err.code !== 'EEXIST') throw err
|
||||
}
|
||||
catch (e) {
|
||||
fs.mkdirSync(dir, 0775)
|
||||
}
|
||||
|
||||
fs.unlink(index, function(err) {
|
||||
if (err && err.code !== 'ENOENT') throw err
|
||||
project.name = name
|
||||
|
|
@ -58,7 +63,6 @@ function buildProject(name, project, ctx) {
|
|||
if (ctx.n === 0) console.log('done projects')
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (module == require.main) main()
|
||||
|
|
|
|||
Loading…
Reference in a new issue