aboutsummaryrefslogtreecommitdiff
path: root/tools/tasks/clean.ts
blob: 9f0ebf274ebda18c6a1a93225c05b1ea73b57b08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import * as async from 'async';
import * as del from 'del';
import {APP_DEST, TEST_DEST, TMP_DIR} from '../config';

export = function clean(gulp, plugins, option) {
  return function (done) {

    switch(option) {
      case 'all'    : cleanAll(done);     break;
      case 'dist'   : cleanDist(done);    break;
      case 'test'   : cleanTest(done);    break;
      case 'tmp'    : cleanTmp(done);     break;
      default: done();
    }

  };
};

function cleanAll(done) {
  async.parallel([
    cleanDist,
    cleanTest,
    cleanTmp
  ], done);
}
function cleanDist(done) {
  del(APP_DEST, done);
}
function cleanTest(done) {
  del(TEST_DEST, done);
}
function cleanTmp(done) {
  del(TMP_DIR, done);
}