summarylogtreecommitdiffstats
path: root/fix-package-name.js
blob: 74bcfbd49425b765cda1a9ddb83b9566ecac96ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env node
const path = require("path");
const fs = require("fs");

const parseFile = function (path) {

    if (!fs.existsSync(path)) {
        console.error(`${path}文件不存在`)
        return;
    }
    let content = JSON.parse(fs.readFileSync(path, "utf8"));

    content.name = "wechat-devtools";
    // 开启调试,更新参数
    content['chromium-args'] = content['chromium-args'].replace('--disable-devtools', '--mixed-context').replace('--ignore-gpu-blacklist', '--ignore-gpu-blocklist')
    content.window.height = content.window.width = 1000
    fs.writeFileSync(path, JSON.stringify(content));

};

let basedir = __dirname;
if(undefined !== process.env['srcdir'])
    basedir = process.env['srcdir'] + '/tools';
parseFile(path.resolve(basedir, "../package.nw/package.json"));
parseFile(path.resolve(basedir, "../package.nw/package-lock.json"));