Files
certd/packages/ui/certd-server/before-build.js
T

23 lines
792 B
JavaScript
Raw Normal View History

2026-05-31 01:41:33 +08:00
import fs from "fs";
2024-12-09 22:40:17 +08:00
//瘦身
2026-05-31 01:41:33 +08:00
const filePath = "./node_modules/typeorm/platform/PlatformTools.js";
2024-12-09 22:40:17 +08:00
const find = `const cli_highlight_1 = require("cli-highlight");`;
2026-05-31 01:41:33 +08:00
const rep = "const cli_highlight_1 ={highlight: (str) => { return str }};";
2024-12-09 22:40:17 +08:00
// 在 filePath 找到 find那一行 用 rep 替换
function slimming(filePath, find, rep) {
2026-05-31 01:41:33 +08:00
fs.readFile(filePath, "utf8", function (err, data) {
2024-12-09 22:40:17 +08:00
if (err) {
return console.log(err);
}
var result = data.replace(find, rep);
2026-05-31 01:41:33 +08:00
fs.writeFile(filePath, result, "utf8", function (err) {
2024-12-09 22:40:17 +08:00
if (err) return console.log(err);
});
});
}
slimming(filePath, find, rep);
2026-01-08 00:11:46 +08:00
2026-05-31 01:41:33 +08:00
slimming("./tsconfig.json", `"sourceMap": true,`, `"sourceMap": false,`);
slimming("./tsconfig.json", `"inlineSourceMap": true,`, `"inlineSourceMap": false,`);