【发布时间】:2020-06-15 15:38:26
【问题描述】:
我在 yeoman 中有模板目录,我想复制到目标路径,其中包含我添加到问题中的所有抛出错误的内容,是否有更好的方法来完成此任务?
index.js
'use strict';
const Generator = require('yeoman-generator');
const chalk = require('chalk');
const yosay = require('yosay');
module.exports = class extends Generator {
prompting() {
// Have Yeoman greet the user.
this.log(
yosay(
`Welcome to the epic ${chalk.red(
"generator-cvsdigital-sdk-nodeapp-generator"
)} generator!`
)
);
const prompts = [
{
type: "input",
name: "name",
message: "Your project name",
// Defaults to the project's folder name if the input is skipped
default: this.appname
}
];
return this.prompt(prompts).then(props => {
// To access props later use this.props.someAnswer;
this.props = props;
});
}
// writing() {
// this.fs.copyTpl(
// this.templatePath("package.json"),
// this.destinationPath("package.json")
// );
// this.fs.copyTpl(
// this.templatePath("app"),
// this.destinationPath("src")
// );
// }
writing: function () {
this.fs.copy(
this.templatePath('app/templates'),
this.destinationPath('app/templates')
);
}
install() {
this.installDependencies();
}
};
错误
AssertionError [ERR_ASSERTION]: Trying to copy from a source that does not exist:
源码目录路径
generators/app/templates all the files are in templates that i want to copy to destination
【问题讨论】:
-
遇到同样的问题
标签: node.js yeoman yeoman-generator