From 13a48fc62d6fe083ee15b844cf80978f43a9c1b3 Mon Sep 17 00:00:00 2001 From: msojocs Date: Fri, 28 Jan 2022 00:03:56 +0800 Subject: [PATCH] update to nwjs v0.53.1 --- .gitignore | 1 + .vscode/launch.json | 4 ++-- bin/wechat-devtools | 2 +- conf/node.json | 2 +- conf/nwjs.json | 2 +- docker-compose.yml | 1 + docker/entrypoint | 9 ++++++++- docs/FIX.MD | 5 +++++ test/test | 36 ++++++++---------------------------- test/test1 | 6 ++++++ test/update | 5 +++++ test/upgrade_to_0.49.x | 31 +++++++++++++++++++++++++++++++ tools/fix-package-name-node | 2 +- 13 files changed, 71 insertions(+), 35 deletions(-) create mode 100644 docs/FIX.MD create mode 100644 test/test1 create mode 100644 test/update create mode 100644 test/upgrade_to_0.49.x diff --git a/.gitignore b/.gitignore index b81bd16..1297eea 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ cache/ tmp/ mew/ node_modules +test/mini-ci diff --git a/.vscode/launch.json b/.vscode/launch.json index 5a7bb86..5befe0f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,9 +13,9 @@ "reloadAfterAttached": true, "runtimeArgs": [ "--load-extension=${workspaceFolder}/tmp/data/WeappPlugin", - "--custom-devtools-frontend=file://${workspaceFolder}/tmp/data/WeappPlugin/inspector/", + // "--custom-devtools-frontend=file://${workspaceFolder}/tmp/data/WeappPlugin/inspector/", "--user-data-dir=${workspaceFolder}/tmp/data", - "--remote-debugging-port=9999" + // "--remote-debugging-port=9999" ], "env": { "LANG": "zh_CN.UTF-8" diff --git a/bin/wechat-devtools b/bin/wechat-devtools index 10eb426..3c635f9 100755 --- a/bin/wechat-devtools +++ b/bin/wechat-devtools @@ -16,4 +16,4 @@ USERDATADIR="$( echo ~ )/.config/wechat_devtools" # "$@"参数 LANG=zh_CN.UTF-8 -exec "$root_dir/nwjs/nw" $root_dir/package.nw $EXTENSION2 $INSPECTOR1 "$@" \ No newline at end of file +exec "$root_dir/nwjs/nw" $root_dir/package.nw $EXTENSION2 $INSPECTOR2 "$@" \ No newline at end of file diff --git a/conf/node.json b/conf/node.json index ca058b8..9bb0256 100644 --- a/conf/node.json +++ b/conf/node.json @@ -1,6 +1,6 @@ { "description": "此处版本应与nwjs使用的node版本一致", - "version": "14.5.0", + "version": "16.1.0", "url": "https://npm.taobao.org/mirrors/node/v${version}/node-v${version}-linux-x64.tar.gz", "url-global": "https://nodejs.org/download/release/v${version}/node-v${version}-linux-x64.tar.gz" } \ No newline at end of file diff --git a/conf/nwjs.json b/conf/nwjs.json index 1ae6c9d..0162a47 100644 --- a/conf/nwjs.json +++ b/conf/nwjs.json @@ -1,4 +1,4 @@ { - "version": "0.47.0", + "version": "0.53.1", "url": "https://oss.npmmirror.com/dist/nwjs/v${version}/nwjs-sdk-v${version}-linux-x64.tar.gz" } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index ed03d6e..cd303aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,4 +6,5 @@ services: - .:/workspace environment: - ACTION=${ACTION_MODE:-false} + - https_proxy=${https_proxy:-} entrypoint: /workspace/docker/entrypoint \ No newline at end of file diff --git a/docker/entrypoint b/docker/entrypoint index 96573ac..794c714 100644 --- a/docker/entrypoint +++ b/docker/entrypoint @@ -23,7 +23,12 @@ echo "start" python --version node --version -echo "\ +ACTION_MODE=$( export ACTION_MODE ) +if [ $ACTION_MODE!='true' ]; then + npm set registry https://r.npm.taobao.org # 注册模块镜像 + npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像 + npm cache clean --force # 清空缓存 + echo "\ deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free\ # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free\ @@ -33,11 +38,13 @@ echo "\ deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free\ # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free "> /etc/apt/sources.list +fi apt-get clean; # 清空缓存 apt-get update; # 更新 apt-get install -y libx11-dev libxkbfile-dev p7zip-full +npm install -g npm npm install -g node-gyp node-gyp install node-gyp list diff --git a/docs/FIX.MD b/docs/FIX.MD new file mode 100644 index 0000000..17a40d4 --- /dev/null +++ b/docs/FIX.MD @@ -0,0 +1,5 @@ +# 终端修复 + + 1. 执行`grep -lr "cmd.exe" .` + 2. 解包`core.wxvpkg` + 3. `s="darwin"===process.platform,a="win32"===process.platform` \ No newline at end of file diff --git a/test/test b/test/test index 34276dd..cb02bff 100644 --- a/test/test +++ b/test/test @@ -1,31 +1,11 @@ #!/usr/bin/env node -const path = require("path") -const fs = require("fs") -const {execSync} = require('child_process') +console.log("12312") +// console.log(process.platform); // linux +// const cmdPaths = []; +// cmdPaths.push("/System/Applications/Utilities/Terminal.app", +// "/Applications/Utilities/Terminal.app" +// ) -const workDir = path.resolve(__dirname, "../package.nw") -if(fs.existsSync(`${workDir}/core.wxvpkg`) && fs.stat(`${workDir}/core.wxvpkg`)) - fs.renameSync(`${workDir}/core.wxvpkg`, `${workDir}/core.wxvpkg1`) - -if(!fs.existsSync(`${workDir}/core.wxvpkg1`)){ - console.error('错误') - exit(-1) -} - -console.log(`unwxapkg ${workDir}/core.wxvpkg1 ${workDir}/core.wxvpkg.ext`) -execSync(`cd ${workDir} && unwxapkg core.wxvpkg1 core.wxvpkg.ext`) -const search = execSync(`grep -lr "new_instance" ${workDir}/core.wxvpkg.ext`) -console.log(search.toString()) -const filepath = search.toString(); -execSync(`sed -i 's/"new_instance",/"new_instance","mixed_context",/g' ${filepath}`) -execSync(`sed -i 's/o.new_instance=!0,/o.new_instance=!0,o.mixed_context=!0,/g' ${filepath}`) -execSync(`node ${path.resolve(__dirname, "pack")}`) -// # cd ../package.nw -// # mv core.wxvpkg core.wxvpkg.1 -// # unwxapkg core.wxvpkg.1 core.wxvpkg1 -// # 添加mixed_context -// # 打包 -// # unwxapkg node_modules.wxvpkg node_modules - -// # mixed_context \ No newline at end of file +// console.log(cmdPaths); +console.log(process.env.comspec) diff --git a/test/test1 b/test/test1 new file mode 100644 index 0000000..0971dd0 --- /dev/null +++ b/test/test1 @@ -0,0 +1,6 @@ +#!/bin/bash + +root_dir=$(cd `dirname $0`/.. && pwd -P) +export comspec="/bin/bash" +echo "test" +exec $root_dir/test/test \ No newline at end of file diff --git a/test/update b/test/update new file mode 100644 index 0000000..d364bb3 --- /dev/null +++ b/test/update @@ -0,0 +1,5 @@ +#!/bin/bash + +tools/update-nwjs-node +rm -rf ~/.config/wechat_devtools +bin/wechat-devtools diff --git a/test/upgrade_to_0.49.x b/test/upgrade_to_0.49.x new file mode 100644 index 0000000..4997150 --- /dev/null +++ b/test/upgrade_to_0.49.x @@ -0,0 +1,31 @@ +#!/usr/bin/env node + +const path = require("path") +const fs = require("fs") +const {execSync} = require('child_process') + +const workDir = path.resolve(__dirname, "../package.nw") +if(fs.existsSync(`${workDir}/core.wxvpkg`) && fs.statSync(`${workDir}/core.wxvpkg`).isFile()) + fs.renameSync(`${workDir}/core.wxvpkg`, `${workDir}/core.wxvpkg1`) + +if(!fs.existsSync(`${workDir}/core.wxvpkg1`)){ + console.error('错误') + exit(-1) +} + +console.log(`unwxapkg ${workDir}/core.wxvpkg1 ${workDir}/core.wxvpkg.ext`) +execSync(`cd ${workDir} && unwxapkg core.wxvpkg1 core.wxvpkg.ext`) +const search = execSync(`grep -lr "new_instance" ${workDir}/core.wxvpkg.ext`) +console.log(search.toString()) +const filepath = search.toString(); +execSync(`sed -i 's/"new_instance",/"new_instance","mixed_context",/g' ${filepath}`) +execSync(`sed -i 's/o.new_instance=!0,/o.new_instance=!0,o.mixed_context=!0,/g' ${filepath}`) +execSync(`node ${path.resolve(__dirname, "pack")}`) +// # cd ../package.nw +// # mv core.wxvpkg core.wxvpkg.1 +// # unwxapkg core.wxvpkg.1 core.wxvpkg1 +// # 添加mixed_context +// # 打包 +// # unwxapkg node_modules.wxvpkg node_modules + +// # mixed_context \ No newline at end of file diff --git a/tools/fix-package-name-node b/tools/fix-package-name-node index cdfb331..ce281e3 100644 --- a/tools/fix-package-name-node +++ b/tools/fix-package-name-node @@ -14,7 +14,7 @@ const parseFile = function (path) { content.name = "wechat_devtools"; // 开启调试,更新参数 - content['chromium-args'] = content['chromium-args'].replace('--disable-devtools', '').replace('--ignore-gpu-blacklist', '--ignore-gpu-blocklist') + 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));