-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
113 lines (95 loc) · 3.45 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/// <binding AfterBuild='libs' Clean='clean' />
var gulp = require("gulp");
var concat = require('gulp-concat');
var Config = require('./config/gulpfile.config');
var WebpackConfig = require('./config/webpack.config');
var karma = require("gulp-karma");
var gulpUtil = require("gulp-util");
var webpack = require("gulp-webpack");
var rename = require("gulp-rename");
var rimraf = require("rimraf");
var clean = require('gulp-clean');
var child_process = require("child_process");
var tsc = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var config = new Config();
var webpackConfig = new WebpackConfig();
var paths = {
npm: './node_modules/',
bower:'./bower_components',
lib: './lib/'
};
var libs = [
paths.npm + 'angular/angular.js',
paths.npm + 'angular-route/angular-route.js',
paths.npm + 'angular-sanitize/angular-sanitize.js',
paths.npm + 'angular-touch/angular-touch.js',
paths.npm + 'jquery/dist/jquery.js',
paths.npm + 'rx/dist/rx.all.compat.js',
paths.npm + 'fastclick/lib/fastclick.js',
paths.npm + 'moment/moment.js',
paths.bower + 'angular-ui-tinymce/src/tinymce.js'
];
gulp.task("typedoc", function () {
child_process.exec("typedoc --out ./docs/ ./wwwroot/ --module commonjs --jsx react --experimentalDecorators --ignoreCompilerErrors --exclude node_module");
});
gulp.task('libs', function () {
return gulp.src(libs).pipe(gulp.dest(paths.lib));
});
gulp.task('remove-compiled-js', function () {
return gulp.src(["./src/**/*.js", "./src/**/*.js.map"], { read: false })
.pipe(clean());
});
gulp.task('clean', function (callback) {
rimraf(paths.lib, callback);
});
gulp.task("webpack", ['remove-compiled-js'], function () {
return gulp.src('src/main.ts')
.pipe(webpack(webpackConfig))
.pipe(rename("angular-rx-ui.js"))
.pipe(gulp.dest('dist/'));
});
gulp.task('run-unit-tests', ['compile-ts-tests'], function () {
return gulp.src([
'./lib/moment.js',
'./lib/jquery.js',
'./lib/fastclick.js',
'./lib/rx.all.compat.js',
'./lib/angular.js',
'./lib/angular-route.js',
'./lib/angular-sanitize.js',
'./lib/angular-touch.js',
'./bower_components/tinymce-dist/tinymce.js',
'./bower_components/angular-ui-tinymce/src/tinymce.js',
'./node_modules/angular-mocks/angular-mocks.js',
'./dist/angular-rx-ui.js',
'./test/angular-rx-ui.spec.js'
])
.pipe(karma({
configFile: './config/karma.conf.js',
action: 'run'
}))
.on('error', function (err) {
console.log(err);
this.emit('end');
});
});
gulp.task('compile-ts-tests', ['remove-compiled-js'], function () {
var sourceTsFiles = [config.appTypeScriptReferences,
'./src/**/*.spec.ts'];
var tsResult = gulp.src(sourceTsFiles)
.pipe(tsc({
target: 'ES5',
declarationFiles: false,
noExternalResolve: true
}));
return tsResult.js
.pipe(concat('angular-rx-ui.spec.js'))
.pipe(gulp.dest('./test/'));
});
gulp.task('watch', function () {
gulp.watch([
'./src/**/*.ts', './src/**/*.html', './src/**/*.css', './src/**/*.scss'
], ['remove-compiled-js', 'webpack', 'run-unit-tests']);
});
gulp.task('default', ['remove-compiled-js','libs', 'webpack', 'run-unit-tests','watch']);