I'm building a generator that in part includes scaffolding from another project created with exec
. Depending on user input I need to move or delete parts of this scaffolding.
Right now I'm doing it with node's fs.child_process.spawn
and shelljs
, but seeing as the Yo generator has mkdir
, write
, template
, and copy
, I'm wondering if there's a Yo way to move or delete files and directories.
Yeoman now supports this via the fs
API, which is an in memory filesystem implementation.
this.fs.move('source/file', 'dest/file');
this.fs.copy('source', 'dest');
File System Docs
Still not documented, but this is the delete method (works for me):
this.fs.delete('file/to/delete');
Link: Yeoman issue 1505
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With