gulp-util icon indicating copy to clipboard operation
gulp-util copied to clipboard

more helpful replacement pointers

Open Spongman opened this issue 7 years ago • 8 comments

please add some more helpful replacement pointers to the README.

for example, noop points to through2 as a replacement, but it doesn't mention how to use through2 to do this and it's not immediately clear from the through2 docs how to do this.

please add some simple translations of the examples in the 'Usage' section to the recommended replacements.

Spongman avatar Feb 16 '18 18:02 Spongman

@Spongman noop is equivalent to () => through2.obj(). I agree it could be clearer. If you don't use the return value, an empty function should be enough. Calling noop returns a pass-through stream in object mode.

I'll take some time during the week-end to compile a list of examples of common cases I encountered while helping other modules to migrate.

demurgos avatar Feb 16 '18 18:02 demurgos

How about suggesting gulp-noop (github)?

Personally I'd prefer that a PassThrough stream was used directly, but I suppose it is implementation details.

CodeMan99 avatar Feb 24 '18 04:02 CodeMan99

I am a bit confused by the suggestion to replace gutil.buffer with list-stream. Seems like the more well known bl or concat-stream would be more applicable.

Edit: Oh, I guess bl does not support objectMode, making it a non-starter.

CodeMan99 avatar Feb 24 '18 05:02 CodeMan99

Adding to this - there is no suggested replacement for gulp-decompress

I encountered it using Gatsby:

[email protected]
  └─┬ [email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └─┬ [email protected]
          └─┬ [email protected]
            └── [email protected] 

katekourbatova avatar Apr 20 '18 17:04 katekourbatova

@katekourbatova You are reading this issue incorrectly. This is about improving suggestions for changing plugins using gulp-util. The case you are displaying is that gulp-decompress needs to follow this advice.

Tools should not be replacing whole plugins because they in turn depend on gulp-util. The proper thing to do is have gulp-decompress replace their usage of gulp-util (which is already done https://github.com/kevva/gulp-decompress/commit/d3fdff17810f757056503b0f81a8c06f3fa9dc60).

So for this case specifically, someone in the dependency chain needs to upgrade a version so that a newer version of gulp-decompress is used.

CodeMan99 avatar Apr 20 '18 18:04 CodeMan99

@katekourbatova In fact, it looks like gatsby-plugin-sharp@next solves your issue (though for some reason npm install is still showing the gulp-util deprecation notice, not sure why).

CodeMan99 avatar Apr 20 '18 18:04 CodeMan99

gutil.File => https://www.npmjs.com/package/vinyl gutil.replaceExtension => The .extname property on Vinyl objects or https://www.npmjs.com/package/replace-ext gutil.colors => https://www.npmjs.com/package/ansi-colors gutil.date => https://www.npmjs.com/package/date-format gutil.log => https://www.npmjs.com/package/fancy-log gutil.template => https://www.npmjs.com/package/lodash.template gutil.env => https://www.npmjs.com/package/minimist gutil.beep => https://www.npmjs.com/package/beeper gutil.noop => https://www.npmjs.com/package/through2 gutil.isStream => Use the .isStream() method on Vinyl objects gutil.isBuffer => Use the .isBuffer() method on Vinyl objects gutil.isNull => Use the .isNull() method on Vinyl objects gutil.linefeed => Use the string '\n' in your code gutil.combine => https://www.npmjs.com/package/multipipe gutil.buffer => https://www.npmjs.com/package/list-stream gutil.PluginError => https://www.npmjs.com/package/plugin-error

IbrahemElanany avatar Apr 26 '18 08:04 IbrahemElanany

As a recent newcomer I found it frustrating to get a pointer to "though2" for noop.
I managed to make a couple of noops (a comment above helped) but not a friendly entry.

import through2 from 'through2'
import transfob from 'transfob';

async function noop2() {
	return () => through2.obj()
}
async function noop1() {
	transfob( function( file, enc, next ) {
			next( null, file );
	})
}

craigphicks avatar Aug 05 '19 02:08 craigphicks