-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.ts
57 lines (50 loc) · 1.39 KB
/
gulpfile.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
import * as gulp from 'gulp';
import * as util from 'gulp-util'
import * as runSequence from 'run-sequence';
import * as del from 'del';
import * as chalk from 'chalk';
import {join} from 'path';
import {DEV_DEST, APP_DEST, APP_SRC} from './tools/config';
import * as gulpLoadPlugins from 'gulp-load-plugins';
const plugins = <any>gulpLoadPlugins();
// TODO: split task in diff. files
gulp.task('default', () => {
console.log('Hello world!');
});
gulp.task('clean.dev', () => {
return del([DEV_DEST]).then(p => {
if (p.length > 0) {
util.log('Delete: ', p.join(''));
}
});
});
gulp.task('build.assets.dev', () => {
return gulp.src([
join(APP_SRC, '**'),
'!' + join(APP_SRC, '**', '*.ts')
])
.pipe(gulp.dest(APP_DEST));
});
gulp.task('build.js.dev', () => {
let tsProject = plugins.typescript.createProject('tsconfig.json', {
typescript: require('typescript')
});
let src = [
'typings/browser.d.ts',
join(APP_SRC, '**/*.ts'),
'!' + join(APP_SRC, '**/*.e2e.ts')
//'!' + join(APP_SRC, '**/*.spec.ts')
];
let result = gulp.src(src)
.pipe(plugins.plumber())
.pipe(plugins.sourcemaps.init())
.pipe(plugins.typescript(tsProject));
return result.js
.pipe(plugins.sourcemaps.write('.'))
.pipe(gulp.dest(APP_DEST));
});
gulp.task('build.dev', (done: any) =>
runSequence('clean.dev',
'build.js.dev',
'build.assets.dev',
done));