Files
UserbaseFront/.wb-trash/convert.cjs
T
2026-08-19 00:19:03 +08:00

15 lines
617 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.
const fs = require('fs');
const base = 'D:/SoftProject/yunhai/UserBase/front/src/api/';
const files = ['apiDefinitions.ts', 'globals.d.ts'];
// 仅匹配单引号包裹的 api-path key:'xxxController.method'
const re = /'([a-zA-Z]+?)Controller\./g;
for (const f of files) {
const p = base + f;
let s = fs.readFileSync(p, 'utf8');
const before = (s.match(re) || []).length;
s = s.replace(re, (m, ns) => "'" + ns.charAt(0).toUpperCase() + ns.slice(1) + ".");
fs.writeFileSync(p, s, 'utf8');
const after = (s.match(re) || []).length;
console.log(f + ': replaced ' + before + ' -> remaining ' + after);
}