makedeb


wechat-devtools 2:1.05.2203030-2


WeChat Devtools For Linux.

Click here to go back to the commit logs for wechat-devtools.

Commit:


Hash: e662b5430ae2850b676eaab714ceab98467042cb

Message: upgrade: 1.05.2203030

Diff


diff --git a/.SRCINFO b/.SRCINFO
index 5ed4ccd..ba7a401 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -2,25 +2,28 @@ generated-by = makedeb-makepkg
 
 pkgbase = wechat-devtools
 	pkgdesc = WeChat Devtools For Linux.
-	pkgver = 1.05.2201240
-	pkgrel = 15
+	pkgver = 1.05.2203030
+	pkgrel = 1
 	epoch = 2
 	url = https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html
 	arch = x86_64
 	license = unknown
-	makedepends = p7zip
+	makedepends = python
+	makedepends = p7zip-full
 	makedepends = openssl
 	makedepends = gcc
+	makedepends = g++
 	makedepends = make
 	makedepends = libssh2-1-dev
 	makedepends = libkrb5-dev
+	makedepends = pkg-config
 	depends = gconf2
 	depends = libxkbfile-dev
 	options = !strip
 	source = nwjs-v0.53.1.tar.gz::https://npm.taobao.org/mirrors/nwjs/v0.53.1/nwjs-sdk-v0.53.1-linux-x64.tar.gz
-	source = wechat_devtools_1.05.2201240_x64.exe::https://dldir1.qq.com/WechatWebDev/release/p-ae42ee2cde4d42ee80ac60b35f183a99/wechat_devtools_1.05.2201240_x64.exe
+	source = wechat_devtools_1.05.2203030_x64.exe::https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203030&version_type=1
 	source = node-v16.1.0.tar.gz::https://npm.taobao.org/mirrors/node/v16.1.0/node-v16.1.0-linux-x64.tar.gz
-	source = compiler.tar.gz::https://github.com/msojocs/wechat-devtools-linux/releases/download/v0.19/compiler.tar.gz
+	source = compiler.tar.gz::https://download.fastgit.org/msojocs/wechat-devtools-linux/releases/download/v0.19/compiler.tar.gz
 	source = wechat-devtools.desktop
 	source = logo.svg
 	source = fix-cli.sh
@@ -32,7 +35,7 @@ pkgbase = wechat-devtools
 	source = wxvpkg_unpack.js
 	source = fix-other.sh
 	md5sums = b6f49803c51d0abacca2d1e566c7fe19
-	md5sums = 85552bae33e98eb186c5068419efce03
+	md5sums = 63cb0e75df3704e155185d900258ac1e
 	md5sums = 2280bfbbf29981fd5adce334f40146ff
 	md5sums = a9e061c97afbbc295b5664a2d8065492
 	md5sums = 1abd6b4ebbbb918f601a6c5dbad55a05
diff --git a/PKGBUILD b/PKGBUILD
index 308c06d..0ec0425 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,15 +1,13 @@
 # Maintainer: msojocs <jiyecafe@gmail.com>
-# Contributor: ccat3z <c0ldcat3z@gmail.com>
-# Contributor: bruceutut <zttt183525594@gmail.com>
 
 # 方法参考
 # https://github.com/jiyeme/wechat-devtools
-# https://github.com/dragonation/wechat-devtools
-# https://github.com/cytle/wechat_web_devtools
 
-_wechat_devtools_ver="1.05.2201240"
-_wechat_devtools_url="https://dldir1.qq.com/WechatWebDev/release/p-ae42ee2cde4d42ee80ac60b35f183a99/wechat_devtools_1.05.2201240_x64.exe"
-_wechat_devtools_md5="85552bae33e98eb186c5068419efce03"
+_wechat_devtools_ver="1.05.2203030"
+# https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203030&version_type=1
+_wechat_devtools_url="https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=${_wechat_devtools_ver//\./}&version_type=1"
+# _wechat_devtools_url="https://dldir1.qq.com/WechatWebDev/release/p-ae42ee2cde4d42ee80ac60b35f183a99/wechat_devtools_1.05.2201240_x64.exe"
+_wechat_devtools_md5="63cb0e75df3704e155185d900258ac1e"
 
 _wechat_devtools_exe="wechat_devtools_${_wechat_devtools_ver}_x64.exe"
 _nwjs_ver="0.53.1"
@@ -18,19 +16,19 @@ _node_version="16.1.0"
 
 pkgname=wechat-devtools
 pkgver="${_wechat_devtools_ver}"  # 主版本号
-pkgrel=15   # 次版本号release
+pkgrel=1   # 次版本号release
 epoch=2    # 大版本迭代强制更新(维护者变更,尽量不用)
 pkgdesc="WeChat Devtools For Linux. "
 arch=("x86_64")
 url="https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html"
 license=('unknown')
 depends=('gconf2' 'libxkbfile-dev')
-makedepends=('p7zip' 'openssl' 'gcc' 'make' 'libssh2-1-dev' 'libkrb5-dev')
+makedepends=('python' 'p7zip-full' 'openssl' 'gcc' 'g++' 'make' 'libssh2-1-dev' 'libkrb5-dev' 'pkg-config')
 # compiler 用于可视化,以及编译
 source=("nwjs-v${_nwjs_ver}.tar.gz::https://npm.taobao.org/mirrors/nwjs/v${_nwjs_ver}/nwjs-sdk-v${_nwjs_ver}-linux-x64.tar.gz"
         "${_wechat_devtools_exe}::${_wechat_devtools_url}"
         "node-v${_node_version}.tar.gz::https://npm.taobao.org/mirrors/node/v${_node_version}/node-v${_node_version}-linux-x64.tar.gz"
-        "compiler.tar.gz::https://github.com/msojocs/wechat-devtools-linux/releases/download/v0.19/compiler.tar.gz"
+        "compiler.tar.gz::https://download.fastgit.org/msojocs/wechat-devtools-linux/releases/download/v0.19/compiler.tar.gz"
         "wechat-devtools.desktop"
         "logo.svg"
         "fix-cli.sh"
@@ -64,7 +62,7 @@ prepare() {
     ls | grep node-*linux* | xargs -I{} mv {} node
     ls | grep nwjs-*linux* | xargs -I{} mv {} nwjs
 
-    mkdir tools
+    mkdir -p tools
     for file in *.js *.sh; do
         mv $file tools;
     done
diff --git a/fix-cli.sh b/fix-cli.sh
index 9386cb7..f58f524 100644
--- a/fix-cli.sh
+++ b/fix-cli.sh
@@ -1,6 +1,8 @@
 #! /bin/bash
 
 set -e
+root_dir=$(cd `dirname $0`/.. && pwd -P)
+NW_PACKAGE_DIR="$root_dir/package.nw"
 
 if [ -z "$NW_PACKAGE_DIR" ]; then
     echo -e "\e[1;31m\$NW_PACKAGE_DIR is empty\e[0m" >&2
diff --git a/fix-core.sh b/fix-core.sh
index a34f091..024ca85 100644
--- a/fix-core.sh
+++ b/fix-core.sh
@@ -1,11 +1,13 @@
 #!/bin/bash
-echo "Fix Core"
-
-package_dir="$srcdir/wechat_devtools/code/package.nw"
-tmp_dir=$(mktemp -d)
-unpack_script="$srcdir/wxvpkg_unpack"
-pack_script="$srcdir/wxvpkg_pack"
+root_dir=$(cd `dirname $0`/.. && pwd -P)
 
+package_dir="$root_dir/package.nw"
+tmp_dir="$root_dir/tmp/core"
+mkdir -p $tmp_dir
+unpack_script="$root_dir/tools/wxvpkg_unpack.js"
+pack_script="$root_dir/tools/wxvpkg_pack.js"
+ 
+echo "Fix Core"
 # unpack 文件 到 路径
 node "$unpack_script" "$package_dir/core.wxvpkg" "$tmp_dir/core.wxvpkg"
 
diff --git a/fix-menu.sh b/fix-menu.sh
index 71ad088..9adcfdd 100644
--- a/fix-menu.sh
+++ b/fix-menu.sh
@@ -3,57 +3,126 @@
 
 set -e
 
-if [ -z "$NW_PACKAGE_DIR" ]; then
-    echo -e "\e[1;31m\$NW_PACKAGE_DIR is empty\e[0m" >&2
-    exit 1
-fi
+root_dir=$(cd `dirname $0`/.. && pwd -P)
+NW_PACKAGE_DIR="$root_dir/package.nw"
 
 cd "$NW_PACKAGE_DIR"
-target_file=js/core/index.js
+target_file=js/unpack/hackrequire/index.js
 
 if [ ! -f "$target_file" ]; then
     echo -e "\e[1;31m$target_file is not exist\e[0m" >&2
     exit 1
 fi
-
-if [ "$(wc -l < "$target_file")" -gt 0 ]; then
+# 判断匹配函数,匹配函数不为0,则包含给定字符
+if [ `grep -c "patch wechat devtools begin" $target_file` -ne '0' ];then
     echo -e "\e[1;31m$target_file seems to have been modified\e[0m" >&2
     exit 1
 fi
 
 tmp_file=$(mktemp)
 cat > "$tmp_file" <<EOF
-const oldMenuAppend = nw.Menu.prototype.append
-const oldMenuInsert = nw.Menu.prototype.insert
-function isSeparator(menu_item) {
-  return menu_item && menu_item.type === 'separator'
-}
-nw.Menu.prototype.append = function (menu_item) {
-  const items = this.items
-  const len = this.items.length
-  if (~items.indexOf(menu_item)) return
-  if (len === 0 && isSeparator(menu_item)) {
-    return menu_item._destroy()
-  }
-  if (!isSeparator(menu_item) || !isSeparator(items[len - 1])) {
-    oldMenuAppend.call(this, menu_item)
-  } else {
-    return menu_item._destroy()
-  }
-}
-nw.Menu.prototype.insert = function (menu_item, i) {
-  const items = this.items
-  const len = this.items.length
-  if (~items.indexOf(menu_item)) return
-  if (len === 0 && isSeparator(menu_item)) {
-    return menu_item._destroy()
-  }
-  if (!isSeparator(menu_item) || (!isSeparator(items[i]) && !isSeparator(items[i - 1]))) {
-    oldMenuInsert.call(this, menu_item)
-  } else {
-    return menu_item._destroy()
-  }
-}
+/* patch wechat devtools begin */
+/* nw-menu.js */
+(() => {
+    try {
+        if (typeof nw === "undefined") {
+            return;
+        }
+        
+        let log = function (content) {
+            process.stderr.write(content + "\n");
+        };
+        
+        let originMenuItem = nw.MenuItem;
+        nw.MenuItem = function MenuItem(options) {
+        
+            options = Object.assign({}, options);
+        
+            delete options.shortcutName;
+            delete options.shouldEnabled;
+        
+            if (options.label && (typeof options.label === "string")) {
+        
+                if (options.label.indexOf("[") !== -1) {
+                    let rest = options.label.split("[").slice(1).join("[").trim();
+                    if (rest[rest.length - 1] === "]") {
+                        rest = rest.slice(0, -1).split("+").map((x) => {
+                            if (!x) { return "+" }
+                            switch (x) {
+                                case "↓": { return "Down"; }
+                                case "↑": { return "Up"; }
+                                case "PAGE↓": { return "PageDown"; }
+                                case "PAGE↑": { return "PageUp"; }
+                                case "←": { return "Left"; }
+                                case "→": { return "Right"; } 
+                                default: { return x; }
+                            }
+                        });
+                        if (rest.length > 1) {
+                            options.key = rest[rest.length - 1];
+                            options.modifiers = rest.slice(0, -1).join("+");
+                        } else {
+                            options.key = rest[0];
+                        }
+                    }
+                    options.label = options.label.split("[")[0];
+                }
+        
+                if (options.label.indexOf("(&") !== -1) {
+                    options.label = options.label.split("(&")[0];
+                }
+                options.label = options.label.replace("&", "").trim();
+        
+                switch (options.label) {
+                    case "Go to Declaration": { options.label = "转到声明"; break; }
+                    case "Go to References": { options.label = "转到引用"; break; }
+                    case "Find All References": { options.label = "查找所有引用"; break; }
+                    case "Find All Implementations": { options.label = "查找所有实现"; break; }
+                }
+        
+            }
+        
+            return new originMenuItem(options);
+        
+        };
+        
+        let originAppend = nw.Menu.prototype.append;
+        nw.Menu.prototype.append = function (item) {
+        
+            if (item.parentMenu) {
+                item.parentMenu.remove(item);
+            }
+            item.parentMenu = this;
+            
+            if ((this.items.length > 0) && 
+                (this.items[this.items.length - 1].type === "separator") &&
+                (item.type === "separator")) {
+                originInsert.call(this, item, this.items.length);
+                return;
+            }
+        
+            if ((this.items.length === 0) && (item.type === "separator")) {
+                originInsert.call(this, item, this.items.length);
+                return;
+            }
+        
+            return originAppend.call(this, item);
+        };
+        
+        let originInsert = nw.Menu.prototype.insert;
+        nw.Menu.prototype.insert = function (item, index) {
+            if (item.parentMenu) {
+                item.parentMenu.remove(item);
+            }
+            item.parentMenu = this;
+            return originInsert.call(this, item, index);
+        };
+    } catch (error) {
+        process.stderr.write(error.message);
+        process.stderr.write(error.stack);
+    }
+})();
+/* patch wechat devtools end */
 EOF
 cat "$target_file" >> "$tmp_file"
 
diff --git a/fix-other.sh b/fix-other.sh
index c179ca6..2f475b4 100644
--- a/fix-other.sh
+++ b/fix-other.sh
@@ -1,7 +1,9 @@
 #!/bin/bash
-
-package_dir="$NW_PACKAGE_DIR"
-tmp_dir=$(mktemp -d)
+set -e
+root_dir=$(cd `dirname $0`/.. && pwd -P)
+srcdir=$root_dir
+tmp_dir="$root_dir/tmp"
+package_dir="$root_dir/package.nw"
 
 # 修复: webview manager
 # 此bug导致以下功能异常: 
@@ -13,7 +15,7 @@ sed -i 's#module.exports = createWebviewManager;#module.exports = createWebviewM
 # 修复:可视化用的wcc,wcsc
 echo "fix: wcc,wcsc"
 if [[ ! -d "$tmp_dir/node_modules" ]];then
-  mkdir "$tmp_dir/node_modules"
+  mkdir -p "$tmp_dir/node_modules"
 fi
 cd $tmp_dir && npm install miniprogram-compiler
 # wcc wcsc
@@ -23,6 +25,7 @@ cd $tmp_dir && npm install miniprogram-compiler
 && mkdir -p "wcc/bin/linux" "wcsc/bin/linux" \
 && cp -r "${tmp_dir}/node_modules/miniprogram-compiler/bin/linux/wcc" "wcc/bin/linux/wcc" \
 && cp -r "${tmp_dir}/node_modules/miniprogram-compiler/bin/linux/wcsc" "wcsc/bin/linux/wcsc" \
+&& chmod 0755 "wcc/bin/linux/wcc" "wcsc/bin/linux/wcsc" \
 && cp -r "${srcdir}/compiler/wcc_node"/* "wcc" \
 && cp -r "${srcdir}/compiler/wcsc_node"/* "wcsc"
 )
@@ -35,6 +38,7 @@ if [[ $NO_WINE == 'true' ]];then
   \cp -rf "${srcdir}/compiler/nodejs/wcsc" "${package_dir}/js/vendor/wcsc"
   \cp -rf "${tmp_dir}/node_modules/miniprogram-compiler/bin/linux/wcc" "${package_dir}/js/vendor/wcc.bin"
   \cp -rf "${tmp_dir}/node_modules/miniprogram-compiler/bin/linux/wcsc" "${package_dir}/js/vendor/wcsc.bin"
+  cd "${package_dir}/js/vendor" && chmod 0755 wcc wcsc wcc.bin wcsc.bin
   node "${package_dir}/js/vendor/generatemd5.js"
 
   current=`date "+%Y-%m-%d %H:%M:%S"`
diff --git a/fix-package-name.js b/fix-package-name.js
index a37f59e..31d94ea 100644
--- a/fix-package-name.js
+++ b/fix-package-name.js
@@ -5,18 +5,21 @@ 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('--ignore-gpu-blacklist', '--ignore-gpu-blocklist') + ' --mixed-context'
+    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, null, 4));
+    fs.writeFileSync(path, JSON.stringify(content));
 
 };
 
-const pkgDir = process.env['NW_PACKAGE_DIR']
-parseFile(`${pkgDir}/package.json`);
-parseFile(`${pkgDir}/package-lock.json`);
+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"));
diff --git a/rebuild-node-modules.sh b/rebuild-node-modules.sh
index e58bca7..928da86 100644
--- a/rebuild-node-modules.sh
+++ b/rebuild-node-modules.sh
@@ -1,35 +1,31 @@
-#! /bin/bash
+#!/bin/bash
+# 参数:
+# 1 ---- NW版本
 
 set -e
+root_dir=$(cd `dirname $0`/.. && pwd -P)
+package_dir="$root_dir/package.nw"
+export PATH="$root_dir/node/bin:$PATH"
 
-if [ -z "$NW_PACKAGE_DIR" ]; then
-    echo -e "\e[1;31m\$NW_PACKAGE_DIR is empty\e[0m" >&2
-    exit 1
+if [ ! -z $1 ];then
+  NW_VERSION=$1
 fi
-
-if [ -z "$NW_VERSION" ]; then
-    echo -e "\e[1;31m\$NW_VERSION is empty\e[0m" >&2
-    exit 1
+if [ -z $NW_VERSION ]; then
+  echo "NW 版本未指定!"
+  exit 1
 fi
 
-TEMP_DIR=$(mktemp -d)
-trap "{ rm -rf $TEMP_DIR; }" EXIT
-
-# prepare python2
-# fix https://github.com/nwjs/nw-gyp/issues/122
-ln -sf "$(which python2)" "$TEMP_DIR/python"
-export PATH=$TEMP_DIR:$PATH
-
-node_modules="$NW_PACKAGE_DIR/node_modules"
-dry_run="n"
-package_dir="$NW_PACKAGE_DIR"
-
-if [ ! -d "$node_modules" ]; then
-    echo -e "\e[1;31m$node_modules is not exist\e[0m" >&2
-    exit 1
+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; }
+  ln -s "$( which python2 )" "$root_dir/node/bin/python"
 fi
 
-# 以下原封复制
+hash nw-gyp 2>/dev/null || {
+  echo "=======请安装nw-gyp======="
+  exit 1
+}
+
 # 代理处理
 echo "尝试取消所有代理"
 unset http_proxy
@@ -44,6 +40,7 @@ unset ALL_PROXY
 echo -e "\033[42;37m ######## 版本信息 $(date '+%Y-%m-%d %H:%M:%S') ########\033[0m"
 echo "NW VERSION: $NW_VERSION"
 echo "nw-gyp version: $( nw-gyp --version )"
+echo "node-gyp version: $( node-gyp --version )"
 echo "node version: $(node --version )"
 echo "npm version: $(npm --version )"
 python --version