-
-
Notifications
You must be signed in to change notification settings - Fork 338
/
gulpfile.js
49 lines (45 loc) · 1.23 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
/**
* Dependencies.
*/
var gulp = require('gulp'),
browserify = require('browserify'),
vinyl_source_stream = require('vinyl-source-stream'),
vinyl_buffer = require('vinyl-buffer'),
jshint = require('gulp-jshint'),
header = require('gulp-header'),
path = require('path'),
fs = require('fs'),
derequire = require('gulp-derequire'),
/**
* Constants.
*/
PKG = require('./package.json'),
/**
* Banner.
*/
banner = fs.readFileSync('banner.txt').toString(),
banner_options = {
pkg: PKG,
currentYear: new Date().getFullYear()
};
gulp.task('lint', function () {
var src = ['gulpfile.js', 'js/**/*.js', 'hooks/**/*.js', 'extra/**/*.js'];
return gulp
.src(src)
.pipe(jshint('.jshintrc')) // Enforce good practics.
.pipe(jshint.reporter('jshint-stylish', { verbose: true }))
.pipe(jshint.reporter('fail'));
});
gulp.task('browserify', function () {
return browserify([path.join(__dirname, PKG.main)], {
standalone: 'iosrtc'
})
.exclude('cordova/exec') // Exclude require('cordova/exec').
.bundle()
.pipe(vinyl_source_stream(PKG.name + '.js'))
.pipe(vinyl_buffer())
.pipe(header(banner, banner_options))
.pipe(derequire())
.pipe(gulp.dest('www/'));
});
gulp.task('default', gulp.series('lint', 'browserify'));