From aa0297d3275709f589c3232a1782f943204a52ad Mon Sep 17 00:00:00 2001 From: msojocs Date: Thu, 3 Feb 2022 15:50:55 +0800 Subject: [PATCH] fix: patch md5 in config.json --- .github/workflows/release.yml | 2 +- test/fix-md5 | 7 +++++++ tools/rebuild-node-modules | 12 +++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 test/fix-md5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a564f6..f7cc8bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,9 +52,9 @@ jobs: sudo rm -rf cache tmp mkdir ${{ env. name }} sudo find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ env.name }} \; - ls -l sudo cp -r "${{ env.name }}/package.nw/node_modules/nodegit" nodegit sudo cp -r "${{ env.name }}/compiler" compiler + ls -ls env: name: 'release-${{ github.ref_name }}' diff --git a/test/fix-md5 b/test/fix-md5 new file mode 100644 index 0000000..0ef200b --- /dev/null +++ b/test/fix-md5 @@ -0,0 +1,7 @@ +#!/bin/bash +package_dir="/mnt/disk1/GitHub/wechat-devtools/package.nw" +cd "${package_dir}/js/vendor" && \ +wcc_md5=$( md5sum wcc.exe|cut -d ' ' -f1 ) && \ +sed -i 's/wcc.exe": ".*"/wcc.exe": "'"${wcc_md5}"'"/g' "config.json" && \ +wcsc_md5=$( md5sum wcsc.exe|cut -d ' ' -f1 ) && \ +sed -i 's/wcsc.exe": ".*"/wcsc.exe": "'"${wcsc_md5}"'"/g' "config.json" \ No newline at end of file diff --git a/tools/rebuild-node-modules b/tools/rebuild-node-modules index 88470fb..dac76ce 100755 --- a/tools/rebuild-node-modules +++ b/tools/rebuild-node-modules @@ -10,6 +10,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli done DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" NW_VERSION=$1 +srcdir=$(cd `dirname $0`/.. && pwd -P) package_dir="$DIR/../package.nw" export PATH="$DIR/../node/bin:$PATH" @@ -29,7 +30,6 @@ if [ -z $NW_VERSION ]; then 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 )" @@ -105,14 +105,20 @@ cp -fr "${package_dir}/node_modules_tmp/node_modules/vscode-ripgrep/bin/rg" "${p 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" +cd "${package_dir}/js/vendor" && \ +wcc_md5=$( md5sum wcc.exe|cut -d ' ' -f1 ) && \ +sed -i 's/wcc.exe": ".*"/wcc.exe": "'"${wcc_md5}"'"/g' "config.json" && \ +wcsc_md5=$( md5sum wcsc.exe|cut -d ' ' -f1 ) && \ +sed -i 's/wcsc.exe": ".*"/wcsc.exe": "'"${wcsc_md5}"'"/g' "config.json" + # 可视化编译 (cd "${package_dir}/node_modules/" \ && rm -rf wcc wcsc \ && mkdir -p "wcc/bin/linux" "wcsc/bin/linux" \ && cp -r "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcc" "wcc/bin/linux/wcc" \ && cp -r "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcsc" "wcsc/bin/linux/wcsc" \ -&& cp -r "${package_dir}/../compiler/wcc_node"/* "wcc" \ -&& cp -r "${package_dir}/../compiler/wcsc_node"/* "wcsc" +&& cp -r "${srcdir}/compiler/wcc_node"/* "wcc" \ +&& cp -r "${srcdir}/compiler/wcsc_node"/* "wcsc" ) rm -rf "${package_dir}/node_modules_tmp"