You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was working in generator 4.12.0 and yo version 3.1.1 (when using registerTransformStream).
However, I see when I upgrade "yo" to 4.1.0, and keep the generator at 4.12.0 it makes a file copy instead of rename. Meaning I get two files output. One with the pre-renamed name and a second with the rename.
When I then upgrade from yeoman generator - 4.12.0 -> 5.2.0 change to queueTransformStream and run the same project (with yo 4.1.0), I don't see any rename, it is as if the transform didn't run at all.
I see that the transform is being called and it does seem to change the basename and path in the transform returned from rename, but somewhere, it is lost when written to disk.
My goal is to change the names of a bunch of files and directories being output, so I am certainly open to better ways of doing this, but I was surprised to see this fail on the upgrade.
The text was updated successfully, but these errors were encountered:
This is a known gulp-rename bug: hparra/gulp-rename#84
It won't work as it is because it clones the file, loosing mem-fs/mem-fs-editor/conflicter custom fields.
I ran across hparra/gulp-rename#84, but didn't experience the Error [ERR_STREAM_WRITE_AFTER_END]: write after end. I also had this working with gulp rename 2.0.0 and yeoman before I upgraded. Between both of those, I didn't think I was running into the error reported.
It is good to know it is still outstanding, and is probably the source of the issue.
While I did not get this working in the latest yo version with gulp-rename, I did find an alternative to renaming files.
I found that I could rename using processDestinationPath to do the renames:
// I pulled out and simplified some of the relevant parts below:letorig='oldStr';letreplacement='newStr';letreplaceFn=(destinationPath)=>{letbasename=path.basename(destinationPath);letdirname=path.dirname(destinationPath);basename=basename.replaceAll(orig,replacement);dirname=dirname.replaceAll(orig,replacement);returnpath.join(dirname,basename);};this.fs.copyTpl(this.templatePath('module/**'),this.destinationPath(path),{ ...templateObj},null,{processDestinationPath: replaceFn});
Since this appears to be something to fix in gulp-rename, I am going to close out this issue for now.
I recently updated to the latest yeoman generator - 5.2.0, and was using gulp-rename 2.0.0 to rename files on output.
This was working in generator 4.12.0 and yo version 3.1.1 (when using
registerTransformStream
).However, I see when I upgrade "yo" to 4.1.0, and keep the generator at 4.12.0 it makes a file copy instead of rename. Meaning I get two files output. One with the pre-renamed name and a second with the rename.
See Proj1.zip
When I then upgrade from yeoman generator - 4.12.0 -> 5.2.0 change to queueTransformStream and run the same project (with yo 4.1.0), I don't see any rename, it is as if the transform didn't run at all.
See Proj2.zip
I see that the transform is being called and it does seem to change the basename and path in the transform returned from rename, but somewhere, it is lost when written to disk.
My goal is to change the names of a bunch of files and directories being output, so I am certainly open to better ways of doing this, but I was surprised to see this fail on the upgrade.
The text was updated successfully, but these errors were encountered: