gulpfile.js 920 Bytes
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));
});