Implement jshint and watch task.

This commit is contained in:
Jürg Lehni 2016-01-25 11:35:15 +01:00
parent 89b3238385
commit 1dcb19ec3b
3 changed files with 52 additions and 0 deletions

22
gulp/tasks/jshint.js Normal file
View file

@ -0,0 +1,22 @@
/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
* http://scratchdisk.com/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
cache = require('gulp-cached');
gulp.task('jshint', function () {
return gulp.src('src/**/*.js')
.pipe(cache('jshint', { optimizeMemory: true }))
.pipe(jshint())
.pipe(jshint.reporter('jshint-summary'));
});

27
gulp/tasks/watch.js Normal file
View file

@ -0,0 +1,27 @@
/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
* http://scratchdisk.com/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
var gulp = require('gulp'),
path = require('path'),
gutil = require('gulp-util');
gulp.task('watch', function () {
gulp.watch('src/**/*.js', ['jshint'])
.on('change', function(event) {
gutil.log(
gutil.colors.green('File ' + event.type + ': ') +
gutil.colors.magenta(path.basename(event.path))
);
});
});

View file

@ -42,6 +42,8 @@
"extend": "^3.0.0",
"gitty": "^3.3.3",
"gulp": "^3.9.0",
"gulp-cached": "^1.1.0",
"gulp-jshint": "^2.0.0",
"gulp-prepro": "^2.0.0",
"gulp-qunit": "git://github.com/lehni/gulp-qunit.git#459c5603ceac460327a40dc89df6f19c786dc61b",
"gulp-rename": "^1.2.2",
@ -54,6 +56,7 @@
"gulp-whitespace": "^0.1.0",
"gulp-zip": "^3.0.2",
"jshint": "2.8.x",
"jshint-summary": "^0.4.0",
"merge-stream": "^1.0.0",
"prepro": "^2.0.0",
"qunitjs": "^1.20.0",