-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
73 lines (62 loc) · 2.12 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
var gulp = require('gulp'),
del = require('del'),
mocha = require('gulp-mocha'),
jshint = require('gulp-jshint'),
header = require('gulp-header'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
browserify = require('gulp-browserify'),
jsonfile = require('jsonfile'),
GitDown = require('gitdown');
gulp.task('lint', function () {
return gulp
.src('./src/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('clean', ['lint'], function (cb) {
del(['./dist/'], cb);
});
gulp.task('bundle', ['clean'], function () {
return gulp
.src('./src/orientationchangeend.js')
.pipe(browserify({
//debug : true
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('version', ['bundle'], function () {
var pkg = jsonfile.readFileSync('./package.json'),
distHeader = '/**\n * @version ' + pkg.version + '\n * @link https://github.com/gajus/' + pkg.name + ' for the canonical source repository\n * @license https://github.com/gajus/' + pkg.name + '/blob/master/LICENSE BSD 3-Clause\n */\n',
bower = jsonfile.readFileSync('./bower.json');
gulp
.src('./dist/' + pkg.name + '.js')
.pipe(header(distHeader))
.pipe(gulp.dest('./dist/'))
.pipe(uglify())
.pipe(rename(pkg.name + '.min.js'))
.pipe(header(distHeader))
.pipe(gulp.dest('./dist/'));
bower.name = pkg.name;
bower.description = pkg.description;
bower.version = pkg.version;
bower.keywords = pkg.keywords;
bower.license = pkg.license;
bower.authors = [pkg.author];
jsonfile.writeFileSync('./bower.json', bower);
});
gulp.task('test', ['version'], function (cb) {
return gulp
.src('./tests/*.js', {read: false})
.pipe(mocha());
});
gulp.task('gitdown', function () {
return GitDown
.read('.gitdown/README.md')
.write('README.md');
});
gulp.task('watch', function () {
gulp.watch(['./src/*', './tests/*', './package.json'], ['default']);
gulp.watch(['./.gitdown/*'], ['gitdown']);
});
gulp.task('default', ['test']);