forked from InfomediaLtd/angular2-materialize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (45 loc) · 1.54 KB
/
gulpfile.js
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
var gulp = require('gulp');
var rimraf = require('gulp-rimraf');
var runSequence = require('run-sequence');
var tsc = require('gulp-typescript');
var paths = {
dist: './dist',
sourceFiles: ['./src/*'],
toDelete: ['./dist/index.ts','./dist/custom-event-polyfill.ts','./dist/materialize-directive.ts','./dist/materialize-module.ts','./dist/src','./dist/app','./dist/test'],
distSourcesFiles: ['./dist/src/*']
};
gulp.task('clean', function () {
return gulp.src(paths.dist, {read: false}).pipe(rimraf({force: true}));
});
gulp.task('copySources', function(){
return gulp.src(paths.sourceFiles).pipe(gulp.dest(paths.dist));
});
gulp.task('tsc', function () {
var tsProject = tsc.createProject('tsconfig.json', {outDir:"dist",declaration:true});
var tsResult = tsProject.src().pipe(tsc(tsProject));
tsResult.pipe(gulp.dest(paths.dist));
return tsResult.dts.pipe(gulp.dest(paths.dist));
});
gulp.task('copy', function(){
return gulp.src(paths.distSourcesFiles).pipe(gulp.dest(paths.dist));
});
gulp.task('cleanup', function () {
return gulp.src(paths.toDelete, {read: false}).pipe(rimraf({force: true}));
});
// entry point - run tasks in a sequence
gulp.task('default', function (callback) {
runSequence(
'clean',
'copySources',
'tsc',
'copy',
'cleanup',
function (error) {
if (error) {
console.log(error.message);
} else {
console.log('FINISHED SUCCESSFULLY');
}
callback(error);
});
});