From 4c5e176ceaac01139c47eeb60c86f4f58e49a9d4 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 1 Nov 2015 11:05:12 -0500 Subject: [PATCH] Adding gulp task help --- gulpfile.js | 38 +++++++++++++++++++------------------- package.json | 1 + 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 0a89e2c..fa4e300 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,4 +1,4 @@ -const gulp = require('gulp'), +const gulp = require('gulp-help')(require('gulp')), _ = require('lodash'), notify = require('gulp-notify'), folderToc = require('folder-toc'), @@ -20,7 +20,7 @@ const gulp = require('gulp'), jscs = require('gulp-jscs'), config = require('./config'); -gulp.task('default', ['server', 'docs'], function() { +gulp.task('default', 'Auto-rebuild site on changes.', ['server', 'docs'], function() { gulp.watch(config.globs.other, ['static']); gulp.watch(_.flatten([ config.globs.templates, @@ -33,19 +33,19 @@ gulp.task('default', ['server', 'docs'], function() { gulp.watch(config.globs.js, ['scripts', 'docs']); }); -gulp.task('docs', ['docs:files'], function() { +gulp.task('docs', 'Build documentation into ./docs directory.', ['docs:files'], function() { folderToc('./docs', { filter: '*.html' }); }); -gulp.task('docs:files', function() { +gulp.task('docs:files', false, function() { return gulp.src(config.globs.js) .pipe(docco()) .pipe(gulp.dest('./docs')); }); -gulp.task('server', ['build'], function() { +gulp.task('server', 'Start development server.', ['build'], function() { gulp.watch(config.buildPath('**/*'), function(file) { return gulp.src(file.path).pipe(connect.reload()); }); @@ -56,14 +56,14 @@ gulp.task('server', ['build'], function() { }); }); -gulp.task('build', ['static', 'markup', 'styles', 'scripts']); +gulp.task('build', 'Build site into ./build directory.', ['static', 'markup', 'styles', 'scripts']); -gulp.task('static', function() { +gulp.task('static', 'Build static files into ./build directory.', function() { return gulp.src(config.globs.other, { base: './src' }) .pipe(gulp.dest(config.buildRoot)); }); -gulp.task('markup', ['markup:svg_styles'], function() { +gulp.task('markup', 'Build markup into ./build directory.', ['markup:svg_styles'], function() { return gulp.src(config.globs.templates) .pipe(frontMatter()) .pipe(hb({ @@ -85,7 +85,7 @@ gulp.task('markup', ['markup:svg_styles'], function() { .pipe(gulp.dest(config.buildRoot)); }); -gulp.task('markup:svg_styles', function() { +gulp.task('markup:svg_styles', false, function() { return gulp.src('./src/sass/svg.scss') .pipe(sass({ includePaths: bourbon.includePaths @@ -99,7 +99,7 @@ gulp.task('markup:svg_styles', function() { .pipe(gulp.dest('./tmp/build')) }); -gulp.task('styles', function() { +gulp.task('styles', 'Build stylesheets into ./build directory.', function() { return gulp.src('./src/sass/main.scss') .pipe(sourcemaps.init()) .pipe(sass({ @@ -113,7 +113,7 @@ gulp.task('styles', function() { .pipe(gulp.dest(config.buildPath('css'))) }); -gulp.task('scripts', function() { +gulp.task('scripts', 'Build scripts into ./build directory', function() { return browserify(config.browserify) .transform(canopy) .transform(babelify) @@ -130,24 +130,24 @@ gulp.task('scripts', function() { .pipe(gulp.dest(config.buildPath('js'))); }); -gulp.task('verify', ['karma:single', 'lint']); +gulp.task('verify', 'Verify (lint and run tests) scripts.', ['karma:single', 'lint']); -gulp.task('verify:watch', ['karma', 'lint:watch']); +gulp.task('verify:watch', 'Auto-verify scripts.', ['karma', 'lint:watch']); -gulp.task('karma', function(done) { +gulp.task('karma', 'Auto-run scripting tests.', function(done) { new karma.Server({ configFile: path.join(__dirname, 'karma.conf.js') }, done).start(); }); -gulp.task('karma:single', function(done) { +gulp.task('karma:single', 'Run scripting tests', function(done) { new karma.Server({ configFile: path.join(__dirname, 'karma.conf.js'), singleRun: true }, done).start(); }); -gulp.task('lint', function() { +gulp.task('lint', 'Lint scripts', function() { return gulp.src(config.globs.lint) .pipe(jscs()) .pipe(jscs.reporter()) @@ -155,11 +155,11 @@ gulp.task('lint', function() { .on('error', notify.onError()) }); -gulp.task('lint:watch', function() { +gulp.task('lint:watch', 'Auto-lint scripts', function() { gulp.watch(config.globs.lint, ['lint']); }); -gulp.task('lint:fix', config.lintRoots.map(function(root) { +gulp.task('lint:fix', 'Fix some lint errors.', config.lintRoots.map(function(root) { return 'lint:fix:' + root; }), function() { return gulp.src('./*.js') @@ -168,7 +168,7 @@ gulp.task('lint:fix', config.lintRoots.map(function(root) { }); config.lintRoots.forEach(function(root) { - gulp.task('lint:fix:' + root, function() { + gulp.task('lint:fix:' + root, false, function() { return gulp.src('./' + root + '/**/*.js') .pipe(jscs({fix: true})) .pipe(gulp.dest('./' + root)); diff --git a/package.json b/package.json index a29cf1e..e0dbd2c 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "gulp-docco": "0.0.4", "gulp-front-matter": "^1.3.0", "gulp-hb": "^2.6.5", + "gulp-help": "^1.6.1", "gulp-jscs": "^3.0.2", "gulp-notify": "^2.0.1", "gulp-rename": "^1.2.2",