This repository has been archived by the owner on Mar 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
76 lines (59 loc) · 1.73 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
// This file is in charge of the build process:
// Running tests, checking code quality, minifying the code, etc.
'use strict';
// Include gulp
var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
/*
* QUALITY tasks.
*/
gulp.task('lint', function() {
var jshint = require('gulp-jshint');
var gjslint = require('gulp-gjslint');
// 80 characters per line is too restrictive!
var lintOptions = {
flags: ['--nojsdoc', '--max_line_length 150', '--custom_jsdoc_tags "property, callback"']
};
return gulp.src(['./lib/*.js', './test/*.js', './gulpfile.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(gjslint(lintOptions))
.pipe(gjslint.reporter('console', {fail: true}))
.pipe(jshint.reporter('fail'));
});
/*
* Tasks for UNIT tests.
*/
gulp.task('pre-test', function() {
gulp.src(['./lib/*.js'])
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], function(done) {
var mocha = require('gulp-mocha');
gulp.src('./test/*.js')
.pipe(mocha({reporter: 'spec'}))
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 }}));
});
/*
* Task to send the coverage report to Coveralls.
*/
gulp.task('coveralls', function(done) {
var coveralls = require('gulp-coveralls');
gulp.src('./coverage/**/lcov.info')
.pipe(coveralls());
});
/*
* RELEASE "tasks".
*
* Note: we use the "gulp release approach":
*
* 1. Create a tag based on current version specified in package.json
* 2. Publish the project to NPM repository.
* 3. Bump the version of package.json, bower.json or/and manifest.json.
* 4. Commit and push to Github.
*/
require('gulp-release-it')(gulp);