paris/gulpfile.js

36 строки
872 B
JavaScript
Исходник Обычный вид История

2017-10-19 09:15:11 +03:00
const gulp = require('gulp');
const ts = require('gulp-typescript');
const clean = require('gulp-clean');
const runSequence = require('run-sequence');
2017-10-20 10:26:54 +03:00
gulp.task('build', ["clean"], function() {
2017-10-19 09:15:11 +03:00
const tsProject = ts.createProject('tsconfig.json');
const merge = require('merge2');
2017-10-19 09:15:11 +03:00
var tsResult = tsProject.src()
.pipe(tsProject());
return merge([
2017-10-20 10:26:54 +03:00
tsResult.dts
.pipe(gulp.dest(tsProject.config.compilerOptions.outDir)),
tsResult.js
.pipe(gulp.dest(tsProject.config.compilerOptions.outDir))
2017-10-19 09:15:11 +03:00
]);
});
gulp.task('clean', function () {
const tsProject = ts.createProject('tsconfig.json');
return gulp.src(tsProject.config.compilerOptions.outDir, { read: false })
2017-10-19 09:15:11 +03:00
.pipe(clean());
});
gulp.task('watch', ['default'], function() {
gulp.watch('src/*.ts', ['default']);
});
gulp.task('default', [], function(cb) {
runSequence('clean', 'build', cb);
});