tscoverage/dist/mod00/mod00.clean.js

43 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-03-21 01:07:34 +01:00
"use strict";
2017-01-18 00:58:09 +01:00
const q = require("smartq");
2016-10-21 17:48:52 +02:00
const paths = require("../npmts.paths");
const npmts_log_1 = require("../npmts.log");
const plugins = require("./mod00.plugins");
2016-09-29 16:19:49 +02:00
/**
* removes the dist directory which will be entirely rebuild
*/
2016-09-22 23:23:16 +02:00
let removeDist = function () {
2016-10-21 17:48:52 +02:00
npmts_log_1.npmtsOra.text('cleaning dist folder');
2016-07-01 02:28:34 +02:00
return plugins.smartfile.fs.remove(paths.distDir);
2016-05-19 22:11:18 +02:00
};
2016-09-29 16:19:49 +02:00
/**
* remove .d.ts files from testDirctory
*/
let removeTestDeclarations = function () {
2016-10-02 20:35:13 +02:00
let done = q.defer();
2016-09-29 16:19:49 +02:00
plugins.smartfile.fs.listFileTree('./test/', '**/*.d.ts').then(fileArray => {
let fileArrayToRemove = plugins.smartpath.transform.toAbsolute(fileArray, process.cwd() + '//test/');
plugins.smartfile.fs.removeManySync(fileArrayToRemove);
done.resolve();
});
};
/**
* remove old pages
*/
2016-09-22 23:23:16 +02:00
let removePages = function () {
2016-10-21 17:48:52 +02:00
npmts_log_1.npmtsOra.text('cleaning pages folder');
2016-08-30 17:57:51 +02:00
return plugins.smartfile.fs.remove(paths.pagesDir);
2016-05-19 22:11:18 +02:00
};
2016-03-21 01:07:34 +01:00
exports.run = function (configArg) {
2016-10-21 17:48:52 +02:00
npmts_log_1.npmtsOra.text('cleaning up from previous builds...');
2016-10-02 20:35:13 +02:00
let done = q.defer();
2016-05-19 22:11:18 +02:00
removeDist()
2016-09-29 16:19:49 +02:00
.then(removeTestDeclarations)
2016-08-30 17:57:51 +02:00
.then(removePages)
2016-03-21 01:07:34 +01:00
.then(function () {
2016-09-06 17:21:25 +02:00
plugins.beautylog.ok('Cleaned up from previous builds!');
2016-03-21 01:07:34 +01:00
done.resolve(configArg);
});
return done.promise;
};