forked from GoogleChromeLabs/sw-precache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (43 loc) · 1.39 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
/* eslint-env node */
'use strict';
var $ = require('gulp-load-plugins')();
var gulp = require('gulp');
var runSequence = require('run-sequence');
var spawn = require('child_process').spawn;
gulp.task('default', ['test', 'lint']);
gulp.task('generate-demo-service-worker', function(callback) {
spawn('gulp', ['--cwd', 'demo', 'generate-service-worker-dev'],
{stdio: 'inherit'}).on('close', callback);
});
gulp.task('lint', ['generate-demo-service-worker'], function() {
return gulp.src(['./**/*.js'])
.pipe($.eslint())
.pipe($.eslint.format())
.pipe($.eslint.failOnError());
});
gulp.task('test', function() {
return gulp.src('test/*.js', {read: false})
.pipe($.mocha())
.on('error', function(error) {
console.error(error);
process.exit(1);
});
});
gulp.task('update-markdown-toc', function() {
return gulp.src('README.md')
.pipe($.doctoc())
// Get rid of the HTML character entities from the anchor values.
.pipe($.replace(/&x27e[89]/g, ''))
.pipe(gulp.dest('.'));
});
gulp.task('publish', ['test', 'lint'], function(callback) {
spawn('npm', ['publish'], {stdio: 'inherit'})
.on('close', callback);
});
gulp.task('gh-pages', function(callback) {
spawn('gulp', ['--cwd', 'demo', 'gh-pages'], {stdio: 'inherit'})
.on('close', callback);
});
gulp.task('release', function(callback) {
runSequence('publish', 'gh-pages', callback);
});