forked from ngOfficeUIFabric/ng-officeuifabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean-build.ts
57 lines (47 loc) · 1.55 KB
/
clean-build.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict';
import {BaseGulpTask} from '../BaseGulpTask';
import * as gulp from 'gulp';
import {BuildConfig} from '../../../config/build';
import {Utils} from '../utils';
import * as yargs from 'yargs';
let $: any = require('gulp-load-plugins')({ lazy: true });
/**
* Removes all generated JavaScript from TypeScript used in the build as the gulp task 'clean-build-ts'.
*
* @class
*/
export class GulpTask extends BaseGulpTask {
/**
* @property {string} description - Help description for the task.
*/
public static description: string = 'Removes all generated JavaScript from TypeScript used in the build';
/**
* @property {Object} options - Any command line flags that can be passed to the task.
*/
public static options: any = {
'verbose': 'Output all TypeScript files being removed'
};
/**
* @property {ICommandLineArgs} args - Command line arguments;
*/
private _args: ICommandLineArgs = yargs.argv;
/** @constructor */
constructor() {
super();
Utils.log('Removing generated build JavaScript files from source tree');
let options: gulp.SrcOptions = {
read: false
};
// get all build JS files
let tempFiles: string[] = BuildConfig.BUILD_JS;
// .. add coverage files
tempFiles.push(BuildConfig.COVERAGE_PATH);
// .. less the JS that should be kept
BuildConfig.BUILD_KEEP_JS.forEach((keepFile: string) => {
tempFiles.push('!' + keepFile);
});
return gulp.src(tempFiles, options)
.pipe($.if(this._args.verbose, $.print()))
.pipe($.rimraf());
}
}