From 0b68af1b0124ec5c4726dcc76daa6e9c982d74df Mon Sep 17 00:00:00 2001 From: msojocs Date: Wed, 16 Feb 2022 10:45:18 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9E=84=E5=BB=BA=E6=97=B6=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=88=A0=E9=99=A4=E4=BB=A3=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 29 ++++++++++------------------- bin/wechat-devtools | 5 ++++- tools/{fix-wcc-wcsc => fix-other} | 11 +++++++++++ tools/fix-webview-manager | 11 ----------- tools/rebuild-node-modules | 30 +++++++++++++++++++----------- tools/update-wechat-devtools-node | 20 ++++---------------- 6 files changed, 48 insertions(+), 58 deletions(-) rename tools/{fix-wcc-wcsc => fix-other} (70%) delete mode 100755 tools/fix-webview-manager diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6255f1a..9ee4283 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: npm uninstall node-gyp -g npm install node-gyp nw-gyp npm -g - - id: tag + - id: Tag run: | tag='continuous' name='Continuous Build' @@ -65,7 +65,7 @@ jobs: chmod a+x appimagetool-x86_64.AppImage ./appimagetool-x86_64.AppImage ./tmp/AppDir env: - name: 'release-${{ github.ref_name }}' + name: 'release-${{ steps.tag.outputs.tag }}' ARCH: '${{ matrix.ARCH }}' - name: Delete unused file @@ -80,7 +80,7 @@ jobs: ls -l cd "${{ env.name }}" env: - name: 'release-${{ github.ref_name }}' + name: 'release-${{ steps.tag.outputs.tag }}' - name: Compress run: | @@ -91,21 +91,12 @@ jobs: sudo rm -rf ${{ env.name }} compiler nodegit ls -l env: - name: 'release-${{ github.ref_name }}' + name: 'release-${{ steps.tag.outputs.tag }}' - - name: Release - uses: softprops/action-gh-release@v1 - with: - # note you'll typically need to create a personal access token - # with permissions to create releases in the other repo - prerelease: true - target_commitish: ${{ github.sha }} - name: ${{ steps.tag.outputs.name }} - tag_name: ${{ steps.tag.outputs.tag }} - files: | - ${{ env.name }}.tar.gz - compiler.tar.gz - nodegit.tar.gz - *.AppImage + - name: Create release and upload artifacts env: - name: 'release-${{ github.ref_name }}' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage + chmod +x pyuploadtool-x86_64.AppImage + ./pyuploadtool-x86_64.AppImage *.AppImage* *.tar.gz diff --git a/bin/wechat-devtools b/bin/wechat-devtools index 220195b..ed99b88 100755 --- a/bin/wechat-devtools +++ b/bin/wechat-devtools @@ -7,7 +7,10 @@ export APPDATA="$( echo ~ )/.config/wechat_devtools" export PATH="$root_dir/wine:$root_dir/node/bin:$root_dir/nwjs:$PATH" export USERPROFILE=$( echo ~ ) -# LANG=zh_CN.UTF-8 exec "$DIR"/../nwjs/nw --load-extension="$DIR"/../nwjs/package.nw/js/ideplugin "$@" +if [ -d ~/.config/wechat_devtools/WeappCache ];then + echo "删除缓存" + rm -rf ~/.config/wechat_devtools/WeappCache +fi EXTENSION1="--load-extension=$root_dir/nwjs/package.nw/js/ideplugin" EXTENSION2="--load-extension=$( echo ~ )/.config/wechat_devtools/WeappPlugin" diff --git a/tools/fix-wcc-wcsc b/tools/fix-other similarity index 70% rename from tools/fix-wcc-wcsc rename to tools/fix-other index 2f42125..31fc431 100755 --- a/tools/fix-wcc-wcsc +++ b/tools/fix-other @@ -5,6 +5,17 @@ srcdir=$root_dir tmp_dir="$root_dir/tmp" package_dir="$root_dir/package.nw" +# 修复: webview manager +# 此bug导致以下功能异常: +# 1. 代码依赖分析不可用 +# 2. 拓展中的“SERVICE MARKET RECOMMENDS”功能不可用 +echo "fix: webview manager" +root_dir=$(cd `dirname $0`/.. && pwd -P) +package_dir="$root_dir/package.nw" +sed -i 's#module.exports = createWebviewManager;#module.exports = createWebviewManager,( /** @type {any} */ (window)).createWebviewManager = createWebviewManager;#g' "$package_dir/js/libs/vseditor/webview-resource/main.js" + +# 修复:可视化用的wcc,wcsc +echo "fix: wcc,wcsc" mkdir "$tmp_dir/node_modules" cd $tmp_dir && npm install miniprogram-compiler # wcc wcsc diff --git a/tools/fix-webview-manager b/tools/fix-webview-manager deleted file mode 100755 index 40ced5b..0000000 --- a/tools/fix-webview-manager +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# 修复 webview manager -# 此bug导致一下功能异常: -# 1. 代码依赖分析不可用 -# 2. 拓展中的“SERVICE MARKET RECOMMENDS”功能不可用 - - -root_dir=$(cd `dirname $0`/.. && pwd -P) -package_dir="$root_dir/package.nw" -sed -i 's#module.exports = createWebviewManager;#module.exports = createWebviewManager,( /** @type {any} */ (window)).createWebviewManager = createWebviewManager;#g' "$package_dir/js/libs/vseditor/webview-resource/main.js" \ No newline at end of file diff --git a/tools/rebuild-node-modules b/tools/rebuild-node-modules index c18deff..b0e3fad 100755 --- a/tools/rebuild-node-modules +++ b/tools/rebuild-node-modules @@ -1,7 +1,7 @@ #!/bin/bash # 参数: # 1 ---- NW版本 -# + SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" @@ -9,10 +9,15 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located done DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" -NW_VERSION=$1 package_dir="$DIR/../package.nw" - export PATH="$DIR/../node/bin:$PATH" + +NW_VERSION=$1 +if [ -z $NW_VERSION ]; then + echo "NW 版本未指定!" + exit 1 +fi + PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'` if [ $PY_VERSION != 2 ]; then hash python2 2>/dev/null || { echo >&2 "I require python2 but it's not installed. Aborting."; exit 1; } @@ -23,10 +28,17 @@ hash nw-gyp 2>/dev/null || { echo "=======请安装nw-gyp=======" exit 1 } -if [ -z $NW_VERSION ]; then - echo "NW 版本未指定!" - exit 1 -fi + +# 代理处理 +echo "尝试取消所有代理" +unset http_proxy +unset HTTP_PROXY +unset https_proxy +unset HTTPS_PROXY +unset socket_proxy +unset SOCKET_PROXY +unset all_proxy +unset ALL_PROXY echo -e "\033[42;37m ######## 版本信息 $(date '+%Y-%m-%d %H:%M:%S') ########\033[0m" echo "NW VERSION: $NW_VERSION" @@ -35,10 +47,6 @@ echo "node version: $(node --version )" echo "npm version: $(npm --version )" python --version -if [[ ! -z $https_proxy || ! -z $http_proxy ]]; then - echo -e "\033[41;37m 警告: 你设置了代理,这有可能导致安装出现异常 $http_proxy, $https_proxy \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 rm -fr "${package_dir}/node_modules/vscode-windows-registry-node" # the module is only available in windows diff --git a/tools/update-wechat-devtools-node b/tools/update-wechat-devtools-node index 15f535c..19d203b 100755 --- a/tools/update-wechat-devtools-node +++ b/tools/update-wechat-devtools-node @@ -242,17 +242,6 @@ const patch_wechat_devtools_core = function () { }); }); }; -const patch_wechat_devtools_webview = function () { - info("Patching wechat-devtools webview supports"); - - return new Promise((resolve, reject) => { - spawn(path.resolve(__dirname, "fix-webview-manager"), [], { - stdio: "inherit", - }).on("close", (code) => { - resolve(); - }); - }); -}; const rebuild_wechat_devtools_node_modules = function () { info("Rebuilding wechat-devtools node modules"); @@ -290,8 +279,8 @@ const patch_wechat_devtools = function () { }); }); }; -const patch_wcc_wcsc = function () { - info("Patching wcc and wcsc"); +const patch_other = function () { + info("Patching Other"); return new Promise((resolve, reject) => { fs.copyFileSync( @@ -302,7 +291,7 @@ const patch_wcc_wcsc = function () { path.resolve(__dirname, "../compiler/wine/wcsc"), path.resolve(__dirname, "../package.nw/js/vendor/wcsc") ); - execSync(path.resolve(__dirname, "fix-wcc-wcsc")) + execSync(path.resolve(__dirname, "fix-other")) resolve(); }); @@ -318,10 +307,9 @@ const start = async () => { await patch_wechat_devtools_editor_selection_autocopy(); await patch_wechat_devtools_CLI(); await patch_wechat_devtools_core(); - await patch_wechat_devtools_webview(); await rebuild_wechat_devtools_node_modules(); await patch_wechat_devtools(); - await patch_wcc_wcsc(); + await patch_other(); console.log( `Succeeded upgrading wechat-devtools to version ${version}` );