Open ghost opened 5 years ago
I'm having the same issue
If you wish a quickfix @alvaromartmart, you can use v1.2.2 meanwhile:
"devDependencies": {
"gulp-rename": "<=1.2.2"
}
registerTransformStream
with gulp-rename
is still an issue even with gulp-rename v1.2.2. However, I get it working with glob.
const glob = require('glob');
writing() {
const files = glob.sync('**', { dot: true, nodir: true, cwd: this.templatePath() })
for (let i in files) {
this.fs.copyTpl(
this.templatePath(files[i]),
this.destinationPath( this.props.destinationFolderPath + '\\' + files[i].replace(/__fileName__/g,this.props.fileName)),
this.props
)
}
}
Still an issue with v2.0.0. With 1.2.2 it works for me.
Having same issue, and what I've noticed is that it seems to be caused when you make changes to file object that is cloned originalFile.clone({ contents: false });
In my case I got it working by replacing gulp-rename with:
class MyTransformer extends Transform {
constructor(props) {
super({ objectMode: true });
this.props = props;
}
_transform(chunk, encoding, callback) {
for (const [pKey, pVal] of Object.entries(this.props)) {
const regExp = new RegExp("{{" + pKey + "}}", "g");
if (chunk.relative.match(regExp)) {
chunk.path = path.join(chunk.base, chunk.relative.replace(regExp, pVal));
}
}
callback(null, chunk);
}
}
This seems to be working and I'm not getting any errors. As soon as I add chunk.clone({ contents: false })
and start using that it crashes. Without it it works.
This is still an issue. Downgrading to <=1.2.2. worked for me
+1 - stream never ending in 1.4.0 when file source >= 100k (approximately) downgrading fixes the problem
Cam everyone who is having issues post what version of node you are using?
had issue with both node 8 and 10
@bendenoz Can you try it with the latest version of node and see if that resolves it?
Node 8 is a year past end of life as well so not something we're trying to support right now, but node 10 not working is something we will fix if its an issue there.
As another thing you could try if you want to be a guinea pig - on line 3 of this package replace require('stream')
with require('readable-stream')
and see if that does anything.
@contra , readable-stream doesn't change anything, but the problem seems to lie in the originalFile.clone call. If I remove it and use the file originalFile directly it works. Tried changing options but didn't help.
The file is created by an old version of gulp-util / vinyl so it might be part of the problem
suryadev99
Hello,
I am trying to use this package as a stream for a Yeoman generator, to rename gitignore files on the fly: https://yeoman.io/authoring/file-system.html#transform-output-files-through-streams
The error received in the terminal seems to come from
readable-stream
:Error [ERR_STREAM_WRITE_AFTER_END]: write after end
Related issue on yeoman repository: https://github.com/yeoman/yo/issues/577
The code posted above works fine with
gulp-rename@1.2.2
, but not with any more recent version.I am wondering if you are aware of this issue, and what would be the difference. According to my very quick scan on the source code, I have only seen newer dependencies versions and a LICENSE file... Not sure exactly what is the cause of this issue.
v1.2.2 dependencies:
v1.4.0 dependencies:
I am also wondering if tthose differences between version
1.2.2
and the more recent ones such as the1.4.0
currently published on NPM are accessible somewhere? https://www.npmjs.com/package/gulp-rename?activeTab=versionsThose new versions do not seem to be available as releases on this repository: https://github.com/hparra/gulp-rename/releases