From 0ab1166dc3a2a28a0d77544f22eb094beee26382 Mon Sep 17 00:00:00 2001 From: msojocs Date: Wed, 2 Feb 2022 11:26:59 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E7=BB=93=E6=9E=84=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 1 + .gitignore | 1 - compact/build | 7 ------ docker/entrypoint | 4 ++-- {compact => old/compact}/Dockerfile | 0 {wine => old/wine}/wcc | 0 {wine => old/wine}/wcsc | 0 test/test-bash | 6 ++++++ test/wine-wcc | 6 ++++++ tools/rebuild-node-modules | 33 +++++++++++++++++++---------- tools/update-wechat-devtools-node | 30 +++++++++++++------------- 11 files changed, 52 insertions(+), 36 deletions(-) delete mode 100644 compact/build rename {compact => old/compact}/Dockerfile (100%) rename {wine => old/wine}/wcc (100%) mode change 100755 => 100644 rename {wine => old/wine}/wcsc (100%) mode change 100755 => 100644 create mode 100644 test/wine-wcc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f31fa4..0455a09 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,6 +52,7 @@ jobs: mkdir ${{ env. name }} find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ env.name }} \; ls -l + cp -r "${{ env.name }}/package.nw/node_modules/nodegit" nodegit env: name: 'release-${{ github.ref_name }}' diff --git a/.gitignore b/.gitignore index 7443910..c37c8bc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ arch/ nwjs/ node/ package.nw -package.nw copy cache/ tmp/ mew/ diff --git a/compact/build b/compact/build deleted file mode 100644 index 351d10e..0000000 --- a/compact/build +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -./tools/setup-wechat-devtools && - -tar cvzf wechat-devtools-compact.tar.gz bin conf license.md node nwjs package.nw patch readme.md res tools wine - - diff --git a/docker/entrypoint b/docker/entrypoint index f99f547..58b8f2d 100644 --- a/docker/entrypoint +++ b/docker/entrypoint @@ -70,7 +70,7 @@ node-gyp list # end test cd /workspace -# rm -rf package.nw -# node nwjs +# rm -rf node nwjs package.nw +# # exec ./tools/rebuild-node-modules 0.53.1 exec ./tools/setup-wechat-devtools-bash diff --git a/compact/Dockerfile b/old/compact/Dockerfile similarity index 100% rename from compact/Dockerfile rename to old/compact/Dockerfile diff --git a/wine/wcc b/old/wine/wcc old mode 100755 new mode 100644 similarity index 100% rename from wine/wcc rename to old/wine/wcc diff --git a/wine/wcsc b/old/wine/wcsc old mode 100755 new mode 100644 similarity index 100% rename from wine/wcsc rename to old/wine/wcsc diff --git a/test/test-bash b/test/test-bash index fc55110..6c4be6d 100644 --- a/test/test-bash +++ b/test/test-bash @@ -2,6 +2,12 @@ root_dir=$(cd `dirname $0`/.. && pwd -P) export PATH="$root_dir/node/bin:$PATH" +export http_proxy="http://127.0.0.1:54321" + + +if [[ ! -z $https_proxy || ! -z $http_proxy ]]; then + echo -e "\033[41;37m 警告: 你设置了代理,有可能导致安装出现异常 \033[0m" +fi PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'` echo $PY_VERSION diff --git a/test/wine-wcc b/test/wine-wcc new file mode 100644 index 0000000..ee01334 --- /dev/null +++ b/test/wine-wcc @@ -0,0 +1,6 @@ +#!/bin/sh + +root_dir=$(cd `dirname $0`/.. && pwd -P) +export PATH="$root_dir/cache/wechat_devtools_1.05.2201240_x64:$PATH" +execute="$root_dir/cache/wechat_devtools_1.05.2201240_x64/node.exe" +wine $execute -e "require('wcc')" \ No newline at end of file diff --git a/tools/rebuild-node-modules b/tools/rebuild-node-modules index aac2fa0..f40cd82 100755 --- a/tools/rebuild-node-modules +++ b/tools/rebuild-node-modules @@ -12,17 +12,6 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" NW_VERSION=$1 package_dir="$DIR/../package.nw" -if [ -z $NW_VERSION ]; then - echo "NW 版本未指定!" - exit 1 -fi -echo -e "\033[42;37m ######## 版本信息 $(date '+%Y-%m-%d %H:%M:%S') ########\033[0m" -echo "目录: $DIR" -echo "NW VERSION: $NW_VERSION" -echo "nw-gyp version: $( nw-gyp --version )" -echo "node version: $(node --version )" -echo "npm version: $(npm --version )" - export PATH="$DIR/../node/bin:$PATH" PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'` if [ $PY_VERSION != 2 ]; then @@ -34,6 +23,21 @@ hash nw-gyp 2>/dev/null || { echo "=======请安装nw-gyp=======" exit 1 } +if [ -z $NW_VERSION ]; then + echo "NW 版本未指定!" + exit 1 +fi + +echo -e "\033[42;37m ######## 版本信息 $(date '+%Y-%m-%d %H:%M:%S') ########\033[0m" +echo "目录: $DIR" +echo "NW VERSION: $NW_VERSION" +echo "nw-gyp version: $( nw-gyp --version )" +echo "node version: $(node --version )" +echo "npm version: $(npm --version )" + +if [[ ! -z $https_proxy || ! -z $http_proxy ]]; then + echo -e "\033[41;37m 警告: 你设置了代理,这有可能导致安装出现异常 \033[0m" +fi rm -fr "${package_dir}/node_modules/vscode-windows-ca-certs" # the module is only available in windows rm -fr "${package_dir}/node_modules/vscode-windows-registry" # the module is only available in windows @@ -69,6 +73,7 @@ rm -fr "${package_dir}/node_modules_tmp/node_modules/spdlog-node" trash \ vscode-oniguruma \ vscode-ripgrep \ + miniprogram-compiler \ nodegit \ --registry=https://registry.npm.taobao.org \ --nodegit_binary_host_mirror=https://npm.taobao.org/mirrors/nodegit/v0.27.0/) # reinstall modules @@ -83,6 +88,7 @@ cp -fr "${package_dir}/node_modules_tmp/node_modules/node-pty" "${package_dir}/n cd "$package_dir/node_modules_tmp/node_modules/native-watchdog" && nw-gyp rebuild --arch=x64 "--target=$NW_VERSION" rm -rf "${package_dir}/node_modules/native-watchdog" && cp -fr "${package_dir}/node_modules_tmp/node_modules/native-watchdog" "${package_dir}/node_modules" +cd "${package_dir}/node_modules_tmp/node_modules/nodegit" && rm -rf .github include src lifecycleScripts vendor utils build/vendor build/Release/.deps cp -fr "${package_dir}/node_modules_tmp/node_modules/nodegit" "${package_dir}/node_modules" (cp -fr "${package_dir}/node_modules_tmp/node_modules/oniguruma" "${package_dir}/node_modules_tmp/node_modules/oniguruma-node") @@ -94,6 +100,11 @@ cp -fr "${package_dir}/node_modules_tmp/node_modules/nodegit" "${package_dir}/no 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" +# wcc wcsc +cd "${package_dir}/js/vendor/" && rm -rf "wcc.exe" "wcsc.exe" +cp "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcc" "${package_dir}/js/vendor/wcc.exe" +cp "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcsc" "${package_dir}/js/vendor/wcsc.exe" + rm -rf "${package_dir}/node_modules_tmp" # 移除旧配置 diff --git a/tools/update-wechat-devtools-node b/tools/update-wechat-devtools-node index e9db147..ef862fd 100644 --- a/tools/update-wechat-devtools-node +++ b/tools/update-wechat-devtools-node @@ -268,22 +268,22 @@ const patch_wechat_devtools = function () { }); }); }; -const patch_wcc_wcsc = function () { - info("Patching wcc and wcsc"); +// const patch_wcc_wcsc = function () { +// info("Patching wcc and wcsc"); - return new Promise((resolve, reject) => { - fs.copyFileSync( - path.resolve(__dirname, "../compiler/wcc"), - path.resolve(__dirname, "../package.nw/js/vendor/wcc.exe") - ); - fs.copyFileSync( - path.resolve(__dirname, "../compiler/wcsc"), - path.resolve(__dirname, "../package.nw/js/vendor/wcsc.exe") - ); +// return new Promise((resolve, reject) => { +// fs.copyFileSync( +// path.resolve(__dirname, "../compiler/wcc"), +// path.resolve(__dirname, "../package.nw/js/vendor/wcc.exe") +// ); +// fs.copyFileSync( +// path.resolve(__dirname, "../compiler/wcsc"), +// path.resolve(__dirname, "../package.nw/js/vendor/wcsc.exe") +// ); - resolve(); - }); -}; +// resolve(); +// }); +// }; const start = async () => { try { @@ -296,7 +296,7 @@ const start = async () => { await patch_wechat_devtools_CLI(); await rebuild_wechat_devtools_node_modules(); await patch_wechat_devtools(); - await patch_wcc_wcsc(); + // await patch_wcc_wcsc(); console.log( `Succeeded upgrading wechat-devtools to version ${version}` );