Copy Yeoman生成器-深度复制空文件夹结构
给定以下生成器文件夹结构;我正在尝试深度复制“for_copy”文件夹下的所有文件夹Copy Yeoman生成器-深度复制空文件夹结构,copy,directory,generator,yeoman,yeoman-generator,Copy,Directory,Generator,Yeoman,Yeoman Generator,给定以下生成器文件夹结构;我正在尝试深度复制“for_copy”文件夹下的所有文件夹 发电机根 应用程序 模板 用于复制 资料 外部的 媒体 所有文件夹都是空的。我希望在调用生成器时为我创建此结构 我尝试过使用fs.copy、bulkCopy和。他们没有一个人在做这项工作 任何关于我如何做到这一点的线索都将不胜感激 请参阅下面的代码片段: writing: function() { this.log('Writing templates...');
- 发电机根
- 应用程序
- 模板
- 用于复制
- 资料
- 外部的
- 媒体
- 用于复制
writing: function() {
this.log('Writing templates...');
//doesn't work
this.fs.copy(
this.templatePath('for_copy'),
this.destinationRoot()
);
//doesn't work
this.bulkCopy(
this.templatePath('for_copy'),
this.destinationRoot()
);
//doesn't work
this.bulkDirectory(
this.templatePath('for_copy'),
this.destinationRoot()
);
//doesn't work
this.bulkDirectory(
this.templatePath('for_copy') +'**/*',
this.destinationRoot()
);
}
约曼只关心文件。当您使用
bulkDirectory
时,实际上是复制文件,而不是复制目录
mkdirp.sync(path.join(this.destinationPath(), 'data'));
mkdirp.sync(path.join(this.destinationPath(), 'external'));
// etc ...
您可以使用模块创建目录
mkdirp.sync(path.join(this.destinationPath(), 'data'));
mkdirp.sync(path.join(this.destinationPath(), 'external'));
// etc ...