-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (58 loc) · 1.62 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
/*
Project: Golden
Author: Copyright (C) 2015, Atanas Laskov
License: BSD license, see LICENSE.md for more details.
http://www.atanaslaskov.com/golden/
*/
var gulp = require('gulp');
var ts = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var KarmaServer = require('karma').Server;
// Compile TypeScript and generate source map
//
gulp.task('compile', function() {
return gulp.src("src/*.ts")
.pipe( sourcemaps.init() )
.pipe( ts({"out": "golden.js"}) ).js
.pipe( sourcemaps.write() )
.pipe( gulp.dest("build") );
});
// Compile libraries
//
gulp.task('lib', function() {
return gulp.src("node_modules/three/build/three.js")
.pipe( gulp.dest("build") );
});
// Default task is to compile and build libs
//
gulp.task("default", gulp.parallel("compile", "lib"));
// Run unit tests
//
gulp.task('test-compile', function() {
return gulp.src([
"typings/globals/jasmine/index.d.ts",
"spec/support/utils.ts",
"spec/*.ts",
])
.pipe( sourcemaps.init() )
.pipe( ts({"out": "spec.js"}) ).js
.pipe( sourcemaps.write() )
.pipe( gulp.dest("spec/build") );
});
gulp.task('test-karma', function( done ) {
new KarmaServer({
configFile: __dirname + '/spec/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('test', gulp.series('test-compile', 'test-karma'));
// Minify the build
//
gulp.task('min', function() {
return gulp.src([ 'build/golden.js', 'build/three.js' ])
.pipe( concat("golden.min.js") )
.pipe( uglify() )
.pipe( gulp.dest("build") );
});