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