fs-path 似乎没有创建正确的 files/folders
fs-path does not seem to be creating correct files/folders
所有 console.logs 都是 运行,但根本没有创建文件夹和文件。我做错了什么?
你可以假设所有 this
都已定义
public writeFiles = () => {
console.log('writing files');
const folderPath = `~/dev/generated-projects/${this.projectName}/server/api/routes/${this.structure.name}`;
console.log('folder path', folderPath);
fsPath.writeFileSync(path.join(folderPath, 'index.ts'), this.indexFile);
fsPath.writeFileSync(path.join(folderPath, 'routes.ts'), this.routesFile);
fsPath.writeFileSync(path.join(folderPath, 'helpers.ts'), this.helperFile);
console.log('create routes for ', this.structure.name);
}
~
是一个 shell-ism。你需要展开Expanding / Resolving ~ in node.js或者直接使用process.env.HOME
。
所有 console.logs 都是 运行,但根本没有创建文件夹和文件。我做错了什么?
你可以假设所有 this
都已定义
public writeFiles = () => {
console.log('writing files');
const folderPath = `~/dev/generated-projects/${this.projectName}/server/api/routes/${this.structure.name}`;
console.log('folder path', folderPath);
fsPath.writeFileSync(path.join(folderPath, 'index.ts'), this.indexFile);
fsPath.writeFileSync(path.join(folderPath, 'routes.ts'), this.routesFile);
fsPath.writeFileSync(path.join(folderPath, 'helpers.ts'), this.helperFile);
console.log('create routes for ', this.structure.name);
}
~
是一个 shell-ism。你需要展开Expanding / Resolving ~ in node.js或者直接使用process.env.HOME
。