我正在开发一个自定义的 Angular Schematic。此原理图必须访问 Angular 项目中将使用原理图的文件夹。(该文件夹包含生成我的 .ts 文件所需的配置文件)。原理图将提示用户输入路径(存储在 configFilesPath 中)
到目前为止,我只能通过这种方式访问此文件夹:
export const readConfigFilefromPath = (configFilesPath: string): string | undefined => {
// ...
const path = __dirname + "\\..\\..\\..\\..\\..\\src\\app\\" + configFilesPath;
// ...
}
有没有更好的方法从原理图访问路径?