forked from CrowdHailer/fn.js
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGulpfile.js
77 lines (66 loc) · 1.5 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
var fs = require('fs');
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')({
scope: ['devDependencies']
});
var args = require('yargs').argv;
gulp.task('lint', function () {
return gulp
.src(['./src/index.js'])
.pipe(plugins.eslint({
globals: {
'fn': true
}
}))
.pipe(plugins.eslint.format())
.pipe(plugins.eslint.failOnError());
});
gulp.task('wrap', ['lint'], function () {
return gulp
.src(['./src/index.js'])
.pipe(plugins.wrapUmd({
exports: 'fn',
namespace: 'fn',
template: fs.readFileSync('./umd.jst', { encoding: 'utf8' })
}))
.pipe(plugins.rename('fn.js'))
.pipe(gulp.dest('./build/'));
});
gulp.task('test', ['wrap'], function () {
return gulp
.src(['./tests/**/*.js'])
.pipe(plugins.mocha({
reporter: 'spec',
bail: true,
globals: ['fn']
}));
});
gulp.task('default', ['test']);
gulp.task('bump', function () {
if (!args.rev && !args.ver) {
console.error('You must provide a revision via --rev or version via --ver to continue.');
process.exit(1);
}
var options = {};
if (args.rev) {
options.type = args.rev;
} else {
options.version = args.ver;
}
return gulp
.src([
'./package.json',
'./bower.json'
])
.pipe(plugins.bump(options))
.pipe(gulp.dest('./'));
});
gulp.task('tag', function () {
var pkg = require('./package.json');
var version = 'v' + pkg.version;
plugins.git
.tag(version, 'Tagging release ' + version);
return plugins.git
.push('origin', 'master', { args: '--tags' })
.end();
});