forked from saghul/cordova-plugin-iosrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (47 loc) · 1.35 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
/**
* Dependencies.
*/
var gulp = require('gulp'),
jscs = require('gulp-jscs'),
stylish = require('gulp-jscs-stylish'),
browserify = require('browserify'),
vinyl_source_stream = require('vinyl-source-stream'),
jshint = require('gulp-jshint'),
filelog = require('gulp-filelog'),
header = require('gulp-header'),
path = require('path'),
fs = require('fs'),
/**
* 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(filelog('lint'))
.pipe(jshint('.jshintrc')) // Enforce good practics.
.pipe(jscs('.jscsrc')) // Enforce style guide.
.pipe(stylish.combineWithHintResults())
.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(filelog('browserify'))
.pipe(header(banner, banner_options))
.pipe(gulp.dest('dist/'));
});
gulp.task('default', gulp.series('lint', 'browserify'));