forked from vevedh/ionic-platform-web-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
100 lines (86 loc) · 2.83 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
var gulp = require('gulp'),
buildConfig = require('./build/config.js'),
browserify = require("browserify"),
babelify = require("babelify"),
fs = require("fs"),
eslint = require('gulp-eslint'),
replace = require('gulp-replace'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
del = require('del');
gulp.task('version', ['minify'], function() {
return gulp.src('dist/*.js')
.pipe(replace('VERSION_STRING', buildConfig.versionData.version))
.pipe(gulp.dest('dist'));
});
gulp.task('minify', ['build-bundle'], function() {
return gulp.src('dist/*.js')
.pipe(uglify())
.pipe(rename(function(path) {
path.basename += ".min";
}))
.pipe(gulp.dest('dist'));
});
gulp.task('build', ['version']);
gulp.task('build-core-module', ['clean'], function() {
var stream = null;
browserify({
'entries': buildConfig.sourceFiles.core,
'debug': false,
'transform': [babelify]
}).bundle()
.on("error", function(err) { console.log("Error : " + err.message); })
.pipe(stream = fs.createWriteStream(buildConfig.dist + "/core.js"));
return stream;
});
gulp.task('build-push-module', ['build-core-module'], function() {
return browserify({
'entries': buildConfig.sourceFiles.push,
'debug': false,
'transform': [babelify]
}).bundle()
.on("error", function(err) { console.log("Error : " + err.message); })
.pipe(fs.createWriteStream(buildConfig.dist + "/push.js"));
});
gulp.task('build-deploy-module', ['build-push-module'], function() {
return browserify({
'entries': buildConfig.sourceFiles.deploy,
'debug': false,
'transform': [babelify]
}).bundle()
.on("error", function(err) { console.log("Error : " + err.message); })
.pipe(fs.createWriteStream(buildConfig.dist + "/deploy.js"));
});
gulp.task('build-analytics-module', ['build-deploy-module'], function() {
return browserify({
'entries': buildConfig.sourceFiles.analytics,
'debug': false,
'transform': [babelify]
}).bundle()
.on("error", function(err) { console.log("Error : " + err.message); })
.pipe(fs.createWriteStream(buildConfig.dist + "/analytics.js"));
});
gulp.task('test', function() {
});
gulp.task('build-bundle', ['clean'], function() {
return browserify({
'entries': buildConfig.sourceFiles.bundle,
'debug': false,
'transform': [babelify]
}).bundle()
.on("error", function(err) { console.log("Error : " + err.message); })
.pipe(fs.createWriteStream(buildConfig.dist + "/ionic.io.bundle.js"));
});
gulp.task('clean', ['lint'], function() {
return del(['dist/**/*']);
});
gulp.task('lint', function() {
return gulp.src(['gulpfile.js', 'src/**/*.js'])
.pipe(eslint())
.pipe(eslint.failOnError())
.pipe(eslint.formatEach());
});
gulp.task('watch', ['build'], function() {
gulp.watch(['src/**/*.js'], ['build']);
});
gulp.task('default', ['build']);