2017-01-18 00:58:09 +01:00
|
|
|
import * as q from 'smartq'
|
2016-10-21 17:48:52 +02:00
|
|
|
import paths = require('../npmts.paths')
|
|
|
|
|
|
|
|
import plugins = require('./mod00.plugins')
|
2016-03-21 01:07:34 +01:00
|
|
|
|
2016-09-29 16:19:49 +02:00
|
|
|
/**
|
|
|
|
* removes the dist directory which will be entirely rebuild
|
|
|
|
*/
|
|
|
|
let removeDist = function () {
|
2017-05-13 10:55:35 +02:00
|
|
|
plugins.beautylog.ora.text('cleaning dist folder')
|
|
|
|
return plugins.smartfile.fs.remove(paths.distDir)
|
2016-09-29 16:19:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* remove old pages
|
|
|
|
*/
|
|
|
|
let removePages = function () {
|
2017-05-13 10:55:35 +02:00
|
|
|
plugins.beautylog.ora.text('cleaning pages folder')
|
|
|
|
return plugins.smartfile.fs.remove(paths.pagesDir)
|
2016-09-06 17:21:25 +02:00
|
|
|
}
|
2016-05-19 22:11:18 +02:00
|
|
|
|
2016-09-29 16:19:49 +02:00
|
|
|
export let run = function (configArg) {
|
2017-05-13 10:55:35 +02:00
|
|
|
plugins.beautylog.ora.text('cleaning up from previous builds...')
|
|
|
|
let done = q.defer()
|
|
|
|
removeDist()
|
|
|
|
.then(removePages)
|
|
|
|
.then(function () {
|
|
|
|
plugins.beautylog.ok('Cleaned up from previous builds!')
|
|
|
|
done.resolve(configArg)
|
|
|
|
})
|
|
|
|
return done.promise
|
2016-09-06 17:21:25 +02:00
|
|
|
}
|