wechat-web-devtools-linux/tools/fix-package-name-node
2022-01-28 00:03:56 +08:00

26 lines
805 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'
console.log("arite")
fs.writeFileSync(path, JSON.stringify(content, null, 4));
};
parseFile(path.resolve(__dirname, "../package.nw/package.json"));
parseFile(path.resolve(__dirname, "../package.nw/package-lock.json"));