Closed sunlho closed 6 months ago
了解一下定制pont:https://github.com/alibaba/pont/blob/master/docs/customizedPont.md 你这个情况,把这两个方法覆盖掉试试(具体哪个取决于你用单数据源还是多数据源)
class FileStructures {
getOriginFileStructures() { }
getMultipleOriginsFileStructures() { }
}
export class FileStructures extends OriginFileStructures {
getMultipleOriginsFileStructures() {
for (let generate of this.generators) {
console.log(generate)
generate.dataSource.mods = []
}
return super.getMultipleOriginsFileStructures()
}
}
这样mod文件不会生成了,但是pontCore的覆盖方法我没有找到
试一下这个。注释掉的是原来的代码
getFileStructures() {
const result =
this.usingMultipleOrigins || this.generators.length > 1
? this.getMultipleOriginsFileStructures()
: this.getOriginFileStructures(this.generators[0]);
// js环境时,默认为新用户,生成pontCore文件
// if (this.surrounding === Surrounding.javaScript) {
// if (!fs.existsSync(this.baseDir + '/pontCore.js')) {
// result['pontCore.js'] = getTemplatesDirFile('pontCore.js', 'pontCore/');
// result['pontCore.d.ts'] = getTemplatesDirFile('pontCore.d.ts', 'pontCore/');
// }
// if (this.templateType && this.checkHasTemplateFetch()) {
// result[`${this.templateType}.js`] = getTemplatesDirFile(`${this.templateType}.js`, 'pontCore/');
// result[`${this.templateType}.d.ts`] = getTemplatesDirFile(`${this.templateType}.d.ts`, 'pontCore/');
// }
// } else if (this.surrounding === Surrounding.typeScript) {
// if (!fs.existsSync(this.baseDir + '/pontCore.ts')) {
// result['pontCore.ts'] = getTemplatesDirFile('pontCore.ts', 'pontCore/');
// }
// if (this.templateType && this.checkHasTemplateFetch()) {
// result[`${this.templateType}.ts`] = getTemplatesDirFile(`${this.templateType}.ts`, 'pontCore/');
// }
// }
return result;
}
这个方法是可行的,感谢你的回复
有没有关闭生成mod跟pontCore的方法,我只需要api.d.ts的类型定义就可以了.生成的其他的文件有些多余