wechat-web-devtools-linux/tools/fix-package-name-node
2022-02-03 12:03:38 +08:00

25 lines
825 B
JavaScript

#!/usr/bin/env node
const path = require("path");
const fs = require("fs");
const { spawn } = require("child_process");
const parseFile = function (path) {
console.log("fix start")
if (!fs.existsSync(path)) {
return;
}
console.log("content")
let content = JSON.parse(fs.readFileSync(path, "utf8"));
content.name = "wechat_devtools";
// 开启调试,更新参数
content['chromium-args'] = content['chromium-args'].replace('--disable-devtools', '').replace('--ignore-gpu-blacklist', '--ignore-gpu-blocklist') + ' --mixed-context'
content.window.height = content.window.width = 500
fs.writeFileSync(path, JSON.stringify(content));
};
parseFile(path.resolve(__dirname, "../package.nw/package.json"));
parseFile(path.resolve(__dirname, "../package.nw/package-lock.json"));