一些便于测试的细节处理

This commit is contained in:
msojocs 2022-01-23 12:01:05 +08:00
parent ae44ec1b65
commit 0af4372388
4 changed files with 11 additions and 2 deletions

View File

@ -9,6 +9,8 @@ const parseFile = function (path) {
let content = JSON.parse(@.fs.readFile.sync(path, "utf8")); let content = JSON.parse(@.fs.readFile.sync(path, "utf8"));
content.name = "wechat_devtools"; content.name = "wechat_devtools";
// 开启调试,更新参数
content['chromium-args'] = content['chromium-args'].replace('--disable-devtools', '').replace('--ignore-gpu-blacklist', '--ignore-gpu-blocklist')
@.fs.writeFile.sync(path, JSON.stringify(content, null, 4)); @.fs.writeFile.sync(path, JSON.stringify(content, null, 4));

View File

@ -60,3 +60,5 @@ mkdir -p "${package_dir}/node_modules/vscode-ripgrep/bin"
cp -fr "${package_dir}/node_modules_tmp/node_modules/vscode-ripgrep/bin/rg" "${package_dir}/node_modules/vscode-ripgrep/bin/rg" cp -fr "${package_dir}/node_modules_tmp/node_modules/vscode-ripgrep/bin/rg" "${package_dir}/node_modules/vscode-ripgrep/bin/rg"
rm -fr "${package_dir}/node_modules_tmp" rm -fr "${package_dir}/node_modules_tmp"
# 移除旧配置
rm -fr ~/.config/wechat_devtools

View File

@ -38,7 +38,7 @@ const nwjs = require("../conf/nwjs.json");
lastSize = size; lastSize = size;
lastTime = now; lastTime = now;
lastProgress = progress; lastProgress = progress;
@info(`Downloaded ${@.fs.filename(localPath)}: ${progress.toFixed(2)}%, speed ${speed.toFixed(2)} KiB/s`); process.stdout.write(`Downloaded ${@.fs.filename(localPath)}: ${progress.toFixed(2)}%, speed ${speed.toFixed(2)} KiB/s\r`);
} }
}, },
"onError": this.reject "onError": this.reject

View File

@ -104,13 +104,14 @@ let client = @.net.httpClient();
lastSize = size; lastSize = size;
lastTime = now; lastTime = now;
lastProgress = progress; lastProgress = progress;
@info(`Downloaded ${filename}: ${progress.toFixed(2)}%, speed ${speed.toFixed(2)} KiB/s`); process.stdout.write(`Downloaded ${filename}: ${progress.toFixed(2)}%, speed ${speed.toFixed(2)} KiB/s\r`);
} }
}, },
"onError": this.reject "onError": this.reject
}); });
}).then(function (localPath) { }).then(function (localPath) {
// 解压
@info(`Extracting ${localPath}`); @info(`Extracting ${localPath}`);
@ -134,15 +135,19 @@ let client = @.net.httpClient();
@info(`Upgrading ${@.fs.filename(extractPath)}`); @info(`Upgrading ${@.fs.filename(extractPath)}`);
// 删除元文件
@.fs.deleteFile.sync(@path(__dirname, "../package.nw")); @.fs.deleteFile.sync(@path(__dirname, "../package.nw"));
// 替换
@.fs.moveFile.sync(@path(extractPath, packageDir), @.fs.moveFile.sync(@path(extractPath, packageDir),
@path(__dirname, "../package.nw")); @path(__dirname, "../package.nw"));
// 删除临时
@.fs.deleteFile.sync(extractPath); @.fs.deleteFile.sync(extractPath);
if (@.fs.exists(@path(__dirname, "../nwjs"))) { if (@.fs.exists(@path(__dirname, "../nwjs"))) {
if (!@.fs.exists(@path(__dirname, "../nwjs/package.nw"))) { if (!@.fs.exists(@path(__dirname, "../nwjs/package.nw"))) {
// 链接
@.fs.linkFile("../package.nw", @path(__dirname, "../nwjs/package.nw")); @.fs.linkFile("../package.nw", @path(__dirname, "../nwjs/package.nw"));
} }
} }