-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
52 lines (41 loc) · 1.55 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
/*!
* Paradigm Framework - Web Shared
* Copyright (c) 2017 Miracle Devs, Inc
* Licensed under MIT (https://github.com/MiracleDevs/Paradigm.Web.Shared/blob/master/LICENSE)
*/
var gulp = require("gulp");
var log = require("fancy-log");
var typescript = require("gulp-typescript");
var yargs = require("yargs");
var clean = require("gulp-clean");
var karma = require("karma");
var path = require("path");
var sourceConfigName = path.resolve(yargs.argv["tsconfig"] || "tsconfig.json");
var karmaConfigName = path.resolve(yargs.argv["karma"] || "karma.conf.js");
log("-----------------------------------------");
log("Configuration: " + sourceConfigName);
log("-----------------------------------------");
var tsProject = typescript.createProject(sourceConfigName);
gulp.task("clean-sources", function ()
{
return gulp
.src(path.resolve(tsProject.config.compilerOptions.outDir))
.pipe(clean({ force: true }));
});
gulp.task("build", gulp.series("clean-sources", function ()
{
var result = tsProject.src().pipe(tsProject());
result.js.pipe(gulp.dest(tsProject.config.compilerOptions.outDir));
result.dts.pipe(gulp.dest(tsProject.config.compilerOptions.outDir));
gulp
.src([path.resolve('./package.json'),
path.resolve('./readme.md')])
.pipe(gulp.dest(tsProject.config.compilerOptions.outDir));
return result;
}));
gulp.task("test", function (callback)
{
var karmaServer = new karma.Server({ configFile: karmaConfigName }, callback);
return karmaServer.start();
});
gulp.task("default", gulp.series("build"));