-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal to allow files to pass through dest
without writing them to disk.
#193
Comments
fwiw we searched around quite a bit for other solutions/ideas before coming to this solution. I can't think of another way of being able to emulate the file tree - exactly as it would be if it were processed by Edit: to save you some clicking, here are the proposed commits mentioned by @doowb. |
3 ideas come to mind.
The reason I like the last one is that other vinyl adapters could use it to emulate our behavior. |
I love that idea. It might resolve/allow other things we've wanted to do. |
I think this is my favorite also. I was thinking Also, I think that the var writeFolder = path.dirname(file.path);
fo.mkdirp(writeFolder, file.dirMode, onMkdirp); If this sounds good, I'll put a repo and PR together. |
Why don't you write your own stream that uses the prepare function on the file and not use dest? Would only be 3 lines of code - I don't think this is common enough of a case to warrant adding an option to dest for it, but we can make sure that the prepare logic is accessible so you can use it in your own streams. |
I think that's what @phated is suggesting. I agree, this would be the way to go.
I also agree with this. plus, adding an option to
Lol yeah I suspect it's pretty rare considering it's not possible atm. jk
That would be awesome. I'd love to avoid having to duplicate the code and keep parity. The last thing we want to do is add feature bloat, but I know we'll get a lot of use out of this. I think other devs will find it useful too, once it's exposed. With only a few lines of code it opens up the possibility to do other interesting things |
Interesting side note that I didn't want to type on my phone last night: in refactoring the tests, I've found a lot of inconsistencies with the |
Kind of related: I looked into the two skipped tests in But actually I like the proposed refactor of Maybe make a point of cleaning up options processing as part of the same effort? I have some half-baked work in this direction, but got distracted by diving into the value-or-function helper. Let me know if there's anything you think I might contribute. (edited to fix typo) |
Package scaffolded at https://github.com/gulpjs/vinyl-prepare |
@phated I have some code I started on and can send a PR. I'll update the tests with what you just merged in and add specific |
@doowb awesome, I didn't see where you were working on stuff so I just pushed the logic split from vinyl-fs (no tests). I tested it against vinyl-fs but needed to add pumpify (see https://github.com/gulpjs/vinyl-fs/tree/prepare-stream) |
np... i didn't push anything up, but basically made the same changes as you.
I did something similar, but used When I was adding tests (for high watermark and slow streams), I needed to use |
Due to this always being a Transform stream, the tests will have to always use |
That makes sense. |
I'd like to see the tests you have, since i don't have any yet |
PR sent to |
Basic support for this has landed in master but I still need to some more work on this and get the libraries to 1.0 before the vinyl-fs@3 release. |
@jonschlinkert and I have been trying to figure out a way to pipe files through
dest
but not actually write the files to disk or create the directories.The goal is to ensure the file properties are updated using the same logic from prepare-write, then use the properties in another stream plugin. Our specific use case is to create a directory tree from the destination file paths.
We've come up with this solution, which uses a
file.writeFile
property to skip creating the destination directory and return early inwrite-contents
when set tofalse
.Will you accept a pull request with this change, or suggest another way we could accomplish the same thing?
Thanks.
The text was updated successfully, but these errors were encountered: