From fbc162fe92b6c73c5332b069f2347a0fe8b5d5f3 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Sun, 31 Dec 2017 16:50:31 -0700 Subject: [PATCH] Docs: Remove references to gulp-util --- docs/recipes/automate-release-workflow.md | 4 ++-- docs/recipes/browserify-multiple-destination.md | 4 ++-- docs/recipes/browserify-transforms.md | 4 ++-- docs/recipes/browserify-uglify-sourcemap.md | 4 ++-- docs/recipes/browserify-with-globs.md | 4 ++-- docs/recipes/fast-browserify-builds-with-watchify.md | 6 +++--- docs/recipes/mocha-test-runner-with-gulp.md | 6 +++--- docs/writing-a-plugin/README.md | 11 +++++------ docs/writing-a-plugin/dealing-with-streams.md | 3 +-- docs/writing-a-plugin/guidelines.md | 5 ++--- docs/writing-a-plugin/using-buffers.md | 3 +-- 11 files changed, 25 insertions(+), 29 deletions(-) diff --git a/docs/recipes/automate-release-workflow.md b/docs/recipes/automate-release-workflow.md index 650691c97..6b2f90d04 100644 --- a/docs/recipes/automate-release-workflow.md +++ b/docs/recipes/automate-release-workflow.md @@ -10,7 +10,7 @@ var runSequence = require('run-sequence'); var conventionalChangelog = require('gulp-conventional-changelog'); var conventionalGithubReleaser = require('conventional-github-releaser'); var bump = require('gulp-bump'); -var gutil = require('gulp-util'); +var log = require('gulplog'); var git = require('gulp-git'); var fs = require('fs'); @@ -38,7 +38,7 @@ gulp.task('bump-version', function () { // use minimist (https://www.npmjs.com/package/minimist) to determine with a // command argument whether you are doing a 'major', 'minor' or a 'patch' change. return gulp.src(['./bower.json', './package.json']) - .pipe(bump({type: "patch"}).on('error', gutil.log)) + .pipe(bump({type: "patch"}).on('error', log.error)) .pipe(gulp.dest('./')); }); diff --git a/docs/recipes/browserify-multiple-destination.md b/docs/recipes/browserify-multiple-destination.md index 6a9af199a..474f58286 100644 --- a/docs/recipes/browserify-multiple-destination.md +++ b/docs/recipes/browserify-multiple-destination.md @@ -8,7 +8,7 @@ The below `js` task bundles all the `.js` files under `src/` as entry points and ```js var gulp = require('gulp'); var browserify = require('browserify'); -var gutil = require('gulp-util'); +var log = require('gulplog'); var tap = require('gulp-tap'); var buffer = require('gulp-buffer'); var sourcemaps = require('gulp-sourcemaps'); @@ -21,7 +21,7 @@ gulp.task('js', function () { // transform file objects using gulp-tap plugin .pipe(tap(function (file) { - gutil.log('bundling ' + file.path); + log.info('bundling ' + file.path); // replace file contents with browserify's bundle stream file.contents = browserify(file.path, {debug: true}).bundle(); diff --git a/docs/recipes/browserify-transforms.md b/docs/recipes/browserify-transforms.md index 0137c6ed5..47a0d4d54 100644 --- a/docs/recipes/browserify-transforms.md +++ b/docs/recipes/browserify-transforms.md @@ -13,7 +13,7 @@ var browserify = require('browserify'); var gulp = require('gulp'); var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); -var gutil = require('gulp-util'); +var log = require('gulplog'); var uglify = require('gulp-uglify'); var sourcemaps = require('gulp-sourcemaps'); var reactify = require('reactify'); @@ -33,7 +33,7 @@ gulp.task('javascript', function () { .pipe(sourcemaps.init({loadMaps: true})) // Add transformation tasks to the pipeline here. .pipe(uglify()) - .on('error', gutil.log) + .on('error', log.error) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/js/')); }); diff --git a/docs/recipes/browserify-uglify-sourcemap.md b/docs/recipes/browserify-uglify-sourcemap.md index 08287edb7..cccfec098 100644 --- a/docs/recipes/browserify-uglify-sourcemap.md +++ b/docs/recipes/browserify-uglify-sourcemap.md @@ -17,7 +17,7 @@ var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); var uglify = require('gulp-uglify'); var sourcemaps = require('gulp-sourcemaps'); -var gutil = require('gulp-util'); +var log = require('gulplog'); gulp.task('javascript', function () { // set up the browserify instance on a task basis @@ -32,7 +32,7 @@ gulp.task('javascript', function () { .pipe(sourcemaps.init({loadMaps: true})) // Add transformation tasks to the pipeline here. .pipe(uglify()) - .on('error', gutil.log) + .on('error', log.error) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/js/')); }); diff --git a/docs/recipes/browserify-with-globs.md b/docs/recipes/browserify-with-globs.md index ad7df6f83..72695fb6d 100644 --- a/docs/recipes/browserify-with-globs.md +++ b/docs/recipes/browserify-with-globs.md @@ -14,7 +14,7 @@ var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); var globby = require('globby'); var through = require('through2'); -var gutil = require('gulp-util'); +var log = require('gulplog'); var uglify = require('gulp-uglify'); var sourcemaps = require('gulp-sourcemaps'); var reactify = require('reactify'); @@ -33,7 +33,7 @@ gulp.task('javascript', function () { .pipe(sourcemaps.init({loadMaps: true})) // Add gulp plugins to the pipeline here. .pipe(uglify()) - .on('error', gutil.log) + .on('error', log.error) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/js/')); diff --git a/docs/recipes/fast-browserify-builds-with-watchify.md b/docs/recipes/fast-browserify-builds-with-watchify.md index 32847d7cf..b56469589 100644 --- a/docs/recipes/fast-browserify-builds-with-watchify.md +++ b/docs/recipes/fast-browserify-builds-with-watchify.md @@ -14,7 +14,7 @@ var browserify = require('browserify'); var gulp = require('gulp'); var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); -var gutil = require('gulp-util'); +var log = require('gulplog'); var sourcemaps = require('gulp-sourcemaps'); var assign = require('lodash.assign'); @@ -31,12 +31,12 @@ var b = watchify(browserify(opts)); gulp.task('js', bundle); // so you can run `gulp js` to build the file b.on('update', bundle); // on any dep update, runs the bundler -b.on('log', gutil.log); // output build logs to terminal +b.on('log', log.info); // output build logs to terminal function bundle() { return b.bundle() // log errors if they happen - .on('error', gutil.log.bind(gutil, 'Browserify Error')) + .on('error', log.error.bind(log, 'Browserify Error')) .pipe(source('bundle.js')) // optional, remove if you don't need to buffer file contents .pipe(buffer()) diff --git a/docs/recipes/mocha-test-runner-with-gulp.md b/docs/recipes/mocha-test-runner-with-gulp.md index 775e3a722..4a6b21797 100644 --- a/docs/recipes/mocha-test-runner-with-gulp.md +++ b/docs/recipes/mocha-test-runner-with-gulp.md @@ -22,16 +22,16 @@ gulp.task('default', function() { ### Running mocha tests when files change ```js -// npm install gulp gulp-mocha gulp-util +// npm install gulp gulp-mocha gulplog var gulp = require('gulp'); var mocha = require('gulp-mocha'); -var gutil = require('gulp-util'); +var log = require('gulplog'); gulp.task('mocha', function() { return gulp.src(['test/*.js'], { read: false }) .pipe(mocha({ reporter: 'list' })) - .on('error', gutil.log); + .on('error', log.error); }); gulp.task('watch-mocha', function() { diff --git a/docs/writing-a-plugin/README.md b/docs/writing-a-plugin/README.md index b5042a600..bcd708356 100644 --- a/docs/writing-a-plugin/README.md +++ b/docs/writing-a-plugin/README.md @@ -126,7 +126,7 @@ A simple example showing how to detect & handle each form is provided below, for approach follow the links above. ```js -var PluginError = require('gulp-util').PluginError; +var PluginError = require('plugin-error'); // consts var PLUGIN_NAME = 'gulp-example'; @@ -176,11 +176,10 @@ if (someCondition) { ## Useful resources -* [File object](https://github.com/gulpjs/gulp-util/#new-fileobj) -* [PluginError](https://github.com/gulpjs/gulp-util#new-pluginerrorpluginname-message-options) -* [event-stream](https://github.com/dominictarr/event-stream) -* [BufferStream](https://github.com/nfroidure/BufferStream) -* [gulp-util](https://github.com/gulpjs/gulp-util) +* [File object](https://github.com/gulpjs/vinyl) +* [PluginError](https://github.com/gulpjs/plugin-error) +* [through2](https://www.npmjs.com/package/through2) +* [bufferstreams](https://www.npmjs.com/package/bufferstreams) ## Sample plugins diff --git a/docs/writing-a-plugin/dealing-with-streams.md b/docs/writing-a-plugin/dealing-with-streams.md index 57d390b96..fd518bd66 100644 --- a/docs/writing-a-plugin/dealing-with-streams.md +++ b/docs/writing-a-plugin/dealing-with-streams.md @@ -12,8 +12,7 @@ Let's implement a plugin prepending some text to files. This plugin supports all ```js var through = require('through2'); -var gutil = require('gulp-util'); -var PluginError = gutil.PluginError; +var PluginError = require('plugin-error'); // consts const PLUGIN_NAME = 'gulp-prefixer'; diff --git a/docs/writing-a-plugin/guidelines.md b/docs/writing-a-plugin/guidelines.md index 8d97e4e9c..b810ad8a1 100644 --- a/docs/writing-a-plugin/guidelines.md +++ b/docs/writing-a-plugin/guidelines.md @@ -30,7 +30,7 @@ - If you encounter an error **outside** the stream, such as invalid configuration while creating the stream, you may throw it. 1. Prefix any errors with the name of your plugin - For example: `gulp-replace: Cannot do regexp replace on a stream` - - Use gulp-util's [PluginError](https://github.com/gulpjs/gulp-util#new-pluginerrorpluginname-message-options) class to make this easy + - Use [PluginError](https://github.com/gulpjs/plugin-error) module to make this easy 1. Name your plugin appropriately: it should begin with "gulp-" if it is a gulp plugin - If it is not a gulp plugin, it should not begin with "gulp-" 1. The type of `file.contents` should always be the same going out as it was when it came in @@ -58,8 +58,7 @@ npm is open for everyone, and you are free to make whatever you want but these g ```js // through2 is a thin wrapper around node transform streams var through = require('through2'); -var gutil = require('gulp-util'); -var PluginError = gutil.PluginError; +var PluginError = require('plugin-error'); // Consts const PLUGIN_NAME = 'gulp-prefixer'; diff --git a/docs/writing-a-plugin/using-buffers.md b/docs/writing-a-plugin/using-buffers.md index ae021448b..e35e41b59 100644 --- a/docs/writing-a-plugin/using-buffers.md +++ b/docs/writing-a-plugin/using-buffers.md @@ -9,8 +9,7 @@ If your plugin is relying on a buffer based library, you will probably choose to ```js var through = require('through2'); -var gutil = require('gulp-util'); -var PluginError = gutil.PluginError; +var PluginError = require('plugin-error'); // consts const PLUGIN_NAME = 'gulp-prefixer';