-
Notifications
You must be signed in to change notification settings - Fork 25
/
gulpfile.js
executable file
·65 lines (49 loc) · 1.38 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
'use strict';
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var babel = require('gulp-babel');
var changed = require('gulp-changed');
var chalk = require('chalk');
var app;
gulp.task('lint', function(){
return gulp.src(['lib/*.js', './*.js', './bin/*.js'])
.pipe(eslint())
.pipe(eslint.format());
// .pipe(eslint.failOnError());
});
gulp.task('initClerk', function () {
process.argv.pop();
app = require('./');
app.init({
updateRemotely: false
});
})
gulp.task('buildIndex', function(done) {
app.clerk.indexer.build(function(index){
app.clerk.indexer.write(index, undefined, {static: true});
console.log(chalk.cyan('\n Wat: Rebuilt index.\n'));
process.exit();
done();
});
});
gulp.task('watch', function() {
gulp.watch('src/**/*.js', ['babel']);
});
gulp.task('babel', function() {
var bab = babel();
bab.on('error', function(e) {
console.log(e.stack);
});
bab.on('end', function(e) {
console.log(chalk.cyan(' Wat: Transpiled to ES5.\n'));
});
console.log(chalk.cyan('\n Wat: Transpiling ES5.'));
var stream = gulp.src('src/**/*.js')
.pipe(changed('dist'))
.pipe(bab)
.pipe(gulp.dest('dist'));
return;
});
gulp.task('default', ['babel', 'watch']);
gulp.task('all', ['babel', 'initClerk', 'buildIndex', 'watch']);
gulp.task('index', ['initClerk', 'buildIndex']);