This repository has been archived on 2026-09-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
UserBaseFront/.wb-trash/fixns.cjs
T
chenxing bf6439888e
deploy-userbase-front / build-and-deploy (push) Successful in 3m2s
更新api
2026-08-19 00:26:27 +08:00

27 lines
991 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 纠正当前 api:gen 产物中命名空间的大小写错误
// 映射依据:后端 service 下真实的 *Controller 类名 -> PascalCase 命名空间
const fs = require('fs');
const map = {
Approle: 'AppRole',
Appsettings: 'AppSettings',
Groupauthz: 'GroupAuthz',
Pushsubscription: 'PushSubscription',
Signkeyinternal: 'SignKeyInternal',
Sysgroup: 'SysGroup',
Sysuser: 'SysUser',
};
const targets = ['src/api/apiDefinitions.ts', 'src/api/globals.d.ts'];
for (const f of targets) {
let s = fs.readFileSync(f, 'utf8');
for (const [wrong, correct] of Object.entries(map)) {
// 带引号 key:'Sysgroup. -> 'SysGroup.
s = s.split(`'${wrong}.`).join(`'${correct}.`);
// 裸引用(globals.d.ts 里的 interface/属性声明):Sysgroup: -> SysGroup: / Sysgroup. -> SysGroup.
s = s.split(`${wrong}:`).join(`${correct}:`);
s = s.split(`${wrong}.`).join(`${correct}.`);
}
fs.writeFileSync(f, s);
console.log('fixed', f);
}
console.log('done');