2016-03-21 00:07:34 +00:00
|
|
|
"use strict";
|
2016-09-06 15:21:25 +00:00
|
|
|
require('typings-global');
|
|
|
|
var plugins = require('./npmts.plugins');
|
|
|
|
var paths = require('./npmts.paths');
|
|
|
|
var npmts_promisechain_1 = require('./npmts.promisechain');
|
2016-05-19 20:11:18 +00:00
|
|
|
var removeDist = function () {
|
2016-09-06 15:21:25 +00:00
|
|
|
npmts_promisechain_1.npmtsOra.text('cleaning dist folder');
|
2016-07-01 00:28:34 +00:00
|
|
|
return plugins.smartfile.fs.remove(paths.distDir);
|
2016-05-19 20:11:18 +00:00
|
|
|
};
|
2016-08-30 15:57:51 +00:00
|
|
|
var removePages = function () {
|
2016-09-06 15:21:25 +00:00
|
|
|
npmts_promisechain_1.npmtsOra.text('cleaning pages folder');
|
2016-08-30 15:57:51 +00:00
|
|
|
return plugins.smartfile.fs.remove(paths.pagesDir);
|
2016-05-19 20:11:18 +00:00
|
|
|
};
|
2016-03-21 00:07:34 +00:00
|
|
|
exports.run = function (configArg) {
|
2016-09-06 15:21:25 +00:00
|
|
|
npmts_promisechain_1.npmtsOra.text('cleaning up from previous builds...');
|
2016-03-21 00:07:34 +00:00
|
|
|
var done = plugins.Q.defer();
|
2016-05-19 20:11:18 +00:00
|
|
|
removeDist()
|
2016-08-30 15:57:51 +00:00
|
|
|
.then(removePages)
|
2016-03-21 00:07:34 +00:00
|
|
|
.then(function () {
|
2016-09-06 15:21:25 +00:00
|
|
|
plugins.beautylog.ok('Cleaned up from previous builds!');
|
2016-03-21 00:07:34 +00:00
|
|
|
done.resolve(configArg);
|
|
|
|
});
|
|
|
|
return done.promise;
|
|
|
|
};
|