Я хочу, чтобы этот класс CAPIClass
изменил имя класса, вводимое пользователем, например CMyClassNameClass
, поэтому мой подход состоит в том, чтобы сначала скопировать все файлы, а затем обновить содержимое файла в целевом каталоге. Есть ли способ выполнить эту задачу с помощью yeoman, или мне нужно использовать модуль fs
для чтения файла и обновления содержимого?
api.ts
import { IAPIRequest, IAPIResponse } from '../interface';
import { getApiFaultDetails } from '../common/errordetails';
/**
* @description
*
* @export
* @param {Request} req
* @param {Response} res
* XML example
*
*/
export class CAPIClass extends Wrapper {
public after = after;
constructor() {
super({
configFileName: "package-name-v1.json"
});
}
yeoman index. js
here yeoman will copy all the folder and files to a destination now I want to update file content based on user input className should be updated.
writing() {
const appName = this.props.appName;
this.fs.copy(this.templatePath(), this.destinationPath(`${appName}`), {
class: this.props.className
});
}