gulpfile.js
920 Bytes
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
var gulp = require('gulp');
var fs = require('fs');
var exec = require('child_process').exec;
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var babel = require('gulp-babel');
var gulpDoxx = require('gulp-doxx');
var path = require('path');
gulp.task('default', ['hint', 'babel', 'doc'], function () {
console.log('DONE!');
});
//ES6转ES5
gulp.task('babel', function () {
return gulp.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('dist'));
});
//转文档
gulp.task('doc', function () {
gulp.src(['src/**/*.js', 'README.md'])
.pipe(gulpDoxx({
title: 'JW UHF node client SDK',
urlPrefix: path.join(__dirname, "docs")
}))
.pipe(gulp.dest('docs'))
});
//js代码验证
gulp.task('hint', function () {
return gulp.src(['src/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});