-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
90 lines (76 loc) · 2.49 KB
/
gulpfile.js
File metadata and controls
90 lines (76 loc) · 2.49 KB
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
(function () {
"use strict";
var bower = require("gulp-bower");
var bump = require("gulp-bump");
var colors = require("colors");
var concat = require("gulp-concat");
var del = require("del");
var gulp = require("gulp");
var jshint = require("gulp-jshint");
var path = require("path");
var rename = require("gulp-rename");
var runSequence = require("run-sequence");
var uglify = require("gulp-uglify");
var wct = require("web-component-tester").gulp.init(gulp);
gulp.task("clean", function (cb) {
del(["./dist/**"], cb);
});
gulp.task("clean-bower", function(cb){
del(["./components/**"], cb);
});
gulp.task("bump", function(){
return gulp.src(["./package.json", "./bower.json"])
.pipe(bump({type:"patch"}))
.pipe(gulp.dest("./"));
});
gulp.task("lint", function() {
return gulp.src("src/**/*.js")
.pipe(jshint())
.pipe(jshint.reporter("jshint-stylish"))
.pipe(jshint.reporter("fail"));
});
gulp.task("unminified", function () {
return gulp.src("src/js/*.js")
.pipe(gulp.dest("dist"));
});
gulp.task("source", ["unminified"], function () {
gulp.src("dist/*.js")
.pipe(uglify())
.pipe(rename(function (path) {
path.basename += ".min";
}))
.pipe(gulp.dest("dist"));
});
// ***** Integration Testing ***** //
gulp.task("test:integration", function(cb) {
runSequence("test:local", cb);
});
// ***** Primary Tasks ***** //
gulp.task("bower-clean-install", ["clean-bower"], function(cb){
return bower().on("error", function(err) {
console.log(err);
cb();
});
});
gulp.task("bower-update", function (cb) {
return bower({ cmd: "update"}).on("error", function(err) {
console.log(err);
cb();
});
});
gulp.task("build", function (cb) {
runSequence(["clean", "bower-update"], ["lint", "source"], cb);
});
gulp.task("test", function(cb) {
runSequence("test:integration", cb);
});
gulp.task("default", [], function() {
console.log("********************************************************************".yellow);
console.log(" gulp bower-clean-install: delete and re-install bower components".yellow);
console.log(" gulp bower-update: update bower components".yellow);
console.log(" gulp test: run integration tests".yellow);
console.log(" gulp build: build a distribution version".yellow);
console.log("********************************************************************".yellow);
return true;
});
})();