From 78170a663e93d7cad832395b9742c3d5550d7bc2 Mon Sep 17 00:00:00 2001 From: msojocs Date: Thu, 19 Jan 2023 15:22:16 +0800 Subject: [PATCH] feat: step --- docker/entrypoint | 3 +- tools/fix-core.sh | 35 ++++-- tools/fix-menu.sh | 7 +- tools/setup-wechat-devtools-bash | 180 ++++++++++++++++++++---------- tools/step.sh | 43 +++++++ tools/update-wechat-devtools-bash | 1 + tools/update-wechat-devtools-node | 180 +++++++++++++++--------------- 7 files changed, 284 insertions(+), 165 deletions(-) create mode 100755 tools/step.sh create mode 100755 tools/update-wechat-devtools-bash diff --git a/docker/entrypoint b/docker/entrypoint index 777e6b7..4b5df63 100755 --- a/docker/entrypoint +++ b/docker/entrypoint @@ -1,7 +1,7 @@ #!/bin/bash set -e # 命令出错就退出 -trap 'catchError $LINENO $BASH_COMMAND' SIGHUP SIGINT SIGQUIT EXIT # 捕获错误情况 +trap 'catchError $LINENO $BASH_COMMAND' ERR # 捕获错误情况 catchError() { exit_code=$? @@ -24,7 +24,6 @@ python --version echo "docker node version: $( node --version )" cd /workspace -rm -rf node nwjs package.nw # # exec ./tools/rebuild-node-modules 0.53.1 ./tools/setup-wechat-devtools-bash diff --git a/tools/fix-core.sh b/tools/fix-core.sh index 6a547df..d65b382 100755 --- a/tools/fix-core.sh +++ b/tools/fix-core.sh @@ -1,18 +1,21 @@ #!/bin/bash root_dir=$(cd `dirname $0`/.. && pwd -P) -set -e -trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况 -catchError() { - exit_code=$? - if [ $exit_code -ne 0 ]; then - fail "\033[31mcommand: $2\n at $0:$1\n at $STEP\033[0m" - fi - exit $exit_code -} +# set -e +# trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况 +# catchError() { +# exit_code=$? +# if [ $exit_code -ne 0 ]; then +# fail "\033[31mcommand: $2\n at $0:$1\n at $STEP\033[0m" +# fi +# exit $exit_code +# } notice() { echo -e "\033[36m $1 \033[0m " } +warn() { + echo -e "\033[43;37m 警告 \033[0m $1" +} fail() { echo -e "\033[41;37m 失败 \033[0m $1" } @@ -41,6 +44,8 @@ if [[ ! -z $open_find_result ]];then # replace new_cb_handle="this.props.onWindowOpenFail());Object.keys(window).forEach(key=>{if(!e.window[key]){try{e.window[key]=window[key];}catch(e){console.error(e);}}});" sed -i "s/this.props.onWindowOpenFail());/$new_cb_handle/g" $open_find_result +else + warn "云开发控制台启动点未找到" fi token_find_result=$( grep -lr "constructor(){this._sessionToken=\"\",this._tokenMap={}}" "$tmp_dir/core.wxvpkg" ) @@ -48,6 +53,8 @@ echo "WebSocket token存储对象位置: $token_find_result" if [[ ! -z $token_find_result ]];then new_constructor="constructor(){if(window.tokenData){/*有就直接用*/this._sessionToken=window.tokenData._sessionToken;this._tokenMap=window.tokenData._tokenMap;}else{/*没有就新建*/this._sessionToken=\"\",this._tokenMap={};window.tokenData=this;/*新建完要给中间人*/}}" sed -i "s#constructor(){this._sessionToken=\"\",this._tokenMap={}}#$new_constructor#g" "$token_find_result" +else + warn "WebSocket token存储对象位置未找到" fi # open -a Terminal "`pwd`" --> gnome-terminal @@ -57,6 +64,8 @@ echo "Terminal启动位置: $find_result" if [[ ! -z $find_result ]];then new_str="gnome-terminal" sed -i "s#open -a Terminal \"\`pwd\`\"#$new_str#g" "$find_result" +else + warn "Terminal启动位置未找到" fi # wcc、wcsc处理,设置WINE=fasle环境变量生效 @@ -80,6 +89,8 @@ if [[ "$WINE" != 'true' ]];then sed -i "s#wcc\\.exe#wcc#g" "$find_result" sed -i "s#wcsc\\.exe#wcsc#g" "$find_result" sed -i "s#code/package.nw#package.nw#g" "$find_result" + else + warn "wcc位置未找到" fi # 处理报错时控制台显示的环境 find_result=$( grep -lr '(env:' "$tmp_dir/core.wxvpkg" ) @@ -88,6 +99,8 @@ if [[ "$WINE" != 'true' ]];then for file in $find_result; do sed -i 's#"Windows"#"Linux"#g' "$file" done + else + warn "Windows字符串位置未找到" fi current=`date "+%Y-%m-%d %H:%M:%S"` @@ -108,6 +121,8 @@ if [[ -n $find_result ]];then sed -i 's/mediaQuery.matches/isDark/' $find_result # add functions sed -i 's#}getDefaultTheme#}get isDark(){try{const{DESKTOP_SESSION}=process.env;console.log(DESKTOP_SESSION);let theme="";switch(DESKTOP_SESSION){case"deepin":theme=execSync(`gsettings get com.deepin.dde.appearance gtk-theme`);break;case"gnome":case"gnome-classic":theme=execSync(`gsettings get org.gnome.desktop.interface ${this.gnomeScheme}`);break;default:break}return theme.includes("dark");}catch(err){console.error("尝试获取主题信息失败,使用默认暗色",err);return true;}}get gnomeScheme(){try{const gnomeVersion=execSync(`gnome-shell --version`).toString().replace(/[\\r\\n]/g,"").split(" ");const gnomeVersionNum=gnomeVersion.length==3?Number(gnomeVersion[2]):0;return gnomeVersionNum>=42?"color-scheme":"gtk-theme";}catch(err){console.error("检查gnome版本失败, 使用gtk-theme", err);return "gtk-theme";}}monitorTheme(){try{let monitor=null;const{DESKTOP_SESSION}=process.env;switch(DESKTOP_SESSION){case"deepin":monitor=spawn("gsettings",["monitor","com.deepin.dde.appearance","gtk-theme",]);break;case"gnome":case"gnome-classic":monitor=spawn("gsettings",["monitor","org.gnome.desktop.interface",this.gnomeScheme,]);break;default:console.warn(`NOT SUPPORTED!!!DESKTOP_SESSION:${DESKTOP_SESSION}`);break}monitor\&\&monitor.on("error",(err)=>{console.error("monitorTheme",err)});monitor\&\&monitor.stdout.on("data",e.debounce((chunk)=>{const data=chunk.toString();const t=data.toLowerCase().includes("dark");(this._theme=t?i.Dark:i.Light),this._onDidThemeChange.fire(this._theme)},400));process.on("SIGTERM",(signal)=>{monitor.kill(signal);});}catch(err){console.error("尝试监听主题失败!", err);}}getDefaultTheme#' $find_result +else + warn "theme位置未找到" fi # fix update check @@ -118,6 +133,6 @@ grep -lr "t=>{R(\"new_version_hint" "$find_result" sed -i 's#t=>{R("new_version_hint#t=>{const keys = ["shareData", "windowMap", "isSimple","masterProxyPort", "proxyPort", "masterH2ProxyPort", "h2ProxyPort"];for(let k of keys)t.window.global[k] = global[k];R("new_version_hint#' $find_result # pack 路径 到 文件 -echo "pack" +notice "pack" node "$pack_script" "$tmp_dir/core.wxvpkg" "$package_dir/core.wxvpkg" rm -rf "$tmp_dir/core.wxvpkg" diff --git a/tools/fix-menu.sh b/tools/fix-menu.sh index 9adcfdd..e0789c9 100755 --- a/tools/fix-menu.sh +++ b/tools/fix-menu.sh @@ -3,6 +3,9 @@ set -e +warn() { + echo -e "\033[43;37m 警告 \033[0m $1" +} root_dir=$(cd `dirname $0`/.. && pwd -P) NW_PACKAGE_DIR="$root_dir/package.nw" @@ -15,8 +18,8 @@ if [ ! -f "$target_file" ]; then fi # 判断匹配函数,匹配函数不为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 + warn "$target_file seems to have been modified" + exit 0 fi tmp_file=$(mktemp) diff --git a/tools/setup-wechat-devtools-bash b/tools/setup-wechat-devtools-bash index ed259a7..c0a8cf7 100755 --- a/tools/setup-wechat-devtools-bash +++ b/tools/setup-wechat-devtools-bash @@ -6,6 +6,12 @@ # x.xx.xxxxx - 指定版本号 # +root_dir=$(cd `dirname $0`/.. && pwd -P) + +export PATH="$root_dir/tools:$PATH" +# 步骤 +source "step.sh" + set -e trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况 catchError() { @@ -25,49 +31,67 @@ notice() { echo -e "\033[36m $1 \033[0m " } -root_dir=$(cd `dirname $0`/.. && pwd -P) -echo "==========Initializing node==========" +if [ $CURRENT_STEP == $INSTALL_START ];then + rm -rf "$root_dir"/{node,nwjs,package.nw} + echo "==========Initializing node==========" + if [ -f "$root_dir/node/bin/node" ]; then + step_switch $INSTALL_NODE_SUCCESS + success "node安装完毕" + else + "$root_dir/tools/update-node.sh" + step_switch $INSTALL_NODE_SUCCESS + success "node ok" + fi -if [ -f "$root_dir/node/bin/node" ]; then - success "node安装完毕" -else - "$root_dir/tools/update-node.sh" - success "node ok" + if [ ! -f "$root_dir/node/bin/node" ]; then + step_switch $INSTALL_START + fail "Node安装失败" + exit + fi fi -if [ ! -f "$root_dir/node/bin/node" ]; then - fail "Node安装失败" - exit -fi # 将node加入环境 export PATH="$root_dir/node/bin":$PATH -if [ "$ACTION_MODE" != "true" ]; then - notice "非ACTION模式, 设置镜像源" - npm config set registry http://registry.npmmirror.com/ # 注册模块镜像 - npm config set disturl http://npmmirror.com/dist # node-gyp 编译依赖的 node 源码镜像 - ## 以下选择添加 - npm config set sass_binary_site http://npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像 - npm config set electron_mirror http://npmmirror.com/mirrors/electron/ # electron 二进制包镜像 - npm config set puppeteer_download_host http://npmmirror.com/mirrors # puppeteer 二进制包镜像 - npm config set chromedriver_cdnurl http://npmmirror.com/mirrors/chromedriver # chromedriver 二进制包镜像 - npm config set operadriver_cdnurl http://npmmirror.com/mirrors/operadriver # operadriver 二进制包镜像 - npm config set phantomjs_cdnurl http://npmmirror.com/mirrors/phantomjs # phantomjs 二进制包镜像 - npm config set selenium_cdnurl http://npmmirror.com/mirrors/selenium # selenium 二进制包镜像 - npm config set node_inspector_cdnurl http://npmmirror.com/mirrors/node-inspector # node-inspector 二进制包镜像 - # npm cache clean --force # 清空缓存 -fi -echo "=====安装node-gyp nw-gyp====" -npm uninstall node-gyp -g -npm install node-gyp nw-gyp npm -g -node-gyp install -node-gyp list +node --version +npm --version -echo "==========Initializing nwjs==========" -if [ -f "$root_dir/nwjs/nw" ]; then - success "nwjs安装完毕" -else - node "$root_dir/tools/update-nwjs-node" +if [ $CURRENT_STEP == $INSTALL_NODE_SUCCESS ];then + if [ "$ACTION_MODE" != "true" ]; then + notice "非ACTION模式, 设置镜像源" + npm config set registry http://registry.npmmirror.com/ # 注册模块镜像 + npm config set disturl http://npmmirror.com/dist # node-gyp 编译依赖的 node 源码镜像 + ## 以下选择添加 + npm config set sass_binary_site http://npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像 + npm config set electron_mirror http://npmmirror.com/mirrors/electron/ # electron 二进制包镜像 + npm config set puppeteer_download_host http://npmmirror.com/mirrors # puppeteer 二进制包镜像 + npm config set chromedriver_cdnurl http://npmmirror.com/mirrors/chromedriver # chromedriver 二进制包镜像 + npm config set operadriver_cdnurl http://npmmirror.com/mirrors/operadriver # operadriver 二进制包镜像 + npm config set phantomjs_cdnurl http://npmmirror.com/mirrors/phantomjs # phantomjs 二进制包镜像 + npm config set selenium_cdnurl http://npmmirror.com/mirrors/selenium # selenium 二进制包镜像 + npm config set node_inspector_cdnurl http://npmmirror.com/mirrors/node-inspector # node-inspector 二进制包镜像 + # npm cache clean --force # 清空缓存 + fi + step_switch $INSTALL_NPM_CONFIG_SUCCESS +fi + +if [ $CURRENT_STEP == $INSTALL_NPM_CONFIG_SUCCESS ];then + notice "=====安装node-gyp nw-gyp====" + npm uninstall node-gyp -g + npm install node-gyp nw-gyp -g + node-gyp install + node-gyp list + step_switch $INSTALL_GYP_SUCCESS +fi + +if [ $CURRENT_STEP == $INSTALL_GYP_SUCCESS ];then + echo "==========Initializing nwjs==========" + if [ -f "$root_dir/nwjs/nw" ]; then + success "nwjs安装完毕" + else + node "$root_dir/tools/update-nwjs-node" + fi + step_switch $INSTALL_NW_SUCCESS fi # 7z旧版本解压不正常 @@ -79,31 +103,65 @@ fi # ln -s 7zz 7z # export PATH="$root_dir/tmp/7z:$PATH" -echo "==========Initializing wechat-devtools package==========" +if [ $CURRENT_STEP == $INSTALL_NW_SUCCESS ];then + notice "==========Initializing wechat-devtools package==========" + if [[ $@ == *version* ]];then + # 参数有版本号,优先级高,清空TARGET_VERSION + echo "参数有版本号" + TARGET_VERSION="" + else + # 参数没有版本号,获取 + echo "参数没有版本号" + VERSION_DATA=$( cat "$root_dir/conf/devtools_v" ) + VERSION_DATA=(${VERSION_DATA//,/ }) + TARGET_VERSION="version=${VERSION_DATA[0]}" + fi + echo "TARGET_VERSION: $TARGET_VERSION" + if [ ! -f "$root_dir/package.nw/package.json" ];then + # 没装,直接装 + node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@ + + step_switch $INSTALL_WECHAT_SUCCESS + else + # 装了,获取已安装版本 + DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" ) + DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}" + # 已安装, 比较目标版本 + if [ "$TARGET_VERSION" != "$DEVTOOLS_VERSION" ];then + node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@ + fi + step_switch $INSTALL_WECHAT_SUCCESS + fi +fi -if [[ $@ == *version* ]];then - # 参数有版本号,优先级高,清空TARGET_VERSION - echo "参数有版本号" - TARGET_VERSION="" -else - # 参数没有版本号,获取 - echo "参数没有版本号" - VERSION_DATA=$( cat "$root_dir/conf/devtools_v" ) - VERSION_DATA=(${VERSION_DATA//,/ }) - TARGET_VERSION="version=${VERSION_DATA[0]}" +if [ $CURRENT_STEP == $INSTALL_WECHAT_SUCCESS ];then + notice "Patching wechat-devtools package name" + "$root_dir/tools/fix-package-name.js" + + notice "Patching wechat-devtools editor selection autocopy" + "$root_dir/tools/fix-selection-copy-node" + + notice "Patching wechat-devtools CLI supports" + "$root_dir/tools/fix-cli.sh" + + notice "Patching wechat-devtools core.wxvpkg" + "$root_dir/tools/fix-core.sh" + + notice "Rebuilding wechat-devtools node modules" + nwjsConfig=`cat "$root_dir/conf/nwjs.json" | grep -m 1 -Eo "version\": \"[0-9]{1}\.[0-9]{2}\.[0-9]+"` + nwjs_version="${nwjsConfig/version\": \"/}" + "$root_dir/tools/rebuild-node-modules.sh" "$nwjs_version" + step_switch $INSTALL_REBUILD_SUCCESS fi -echo "TARGET_VERSION: $TARGET_VERSION" -if [ ! -f "$root_dir/package.nw/package.json" ];then - # 没装,直接装 - node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@ - exit 0 + +if [ $CURRENT_STEP == $INSTALL_REBUILD_SUCCESS ];then + notice "Patching wechat-devtools" + "$root_dir/tools/fix-menu.sh" + + notice "Patching Other" + "$root_dir/tools/fix-other.sh" fi -# 装了,获取已安装版本 -DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" ) -DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}" -# 已安装, 比较目标版本 -if [ "$TARGET_VERSION" == "$DEVTOOLS_VERSION" ];then - success "微信开发者工具安装完毕" - exit 0 -fi -node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@ + +success "微信开发者工具安装完毕" + +step_over diff --git a/tools/step.sh b/tools/step.sh new file mode 100755 index 0000000..13acb00 --- /dev/null +++ b/tools/step.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +_dir=$(cd `dirname $0`/.. && pwd -P) +if [ -f "$_dir/tmp/.step" ];then + CURRENT_STEP=`cat "$_dir/tmp/.step"` + unset _dir + if [ "$CURRENT_STEP" == "" ];then + echo "default" + CURRENT_STEP="INSTALL_START" + fi +else + CURRENT_STEP="INSTALL_START" +fi + +INSTALL_START="INSTALL_START" +INSTALL_NODE_SUCCESS="INSTALL_NODE_SUCCESS" +INSTALL_NPM_CONFIG_SUCCESS="INSTALL_NPM_CONFIG_SUCCESS" +INSTALL_GYP_SUCCESS="INSTALL_GYP_SUCCESS" +INSTALL_NW_SUCCESS="INSTALL_NW_SUCCESS" +INSTALL_WECHAT_SUCCESS="INSTALL_WECHAT_SUCCESS" +INSTALL_REBUILD_SUCCESS="INSTALL_REBUILD_SUCCESS" + + +step_switch() { + echo -e "\033[42;36m 切换步骤-> \033[0m $1" + CURRENT_STEP=$1 + _dir=$(cd `dirname $0`/.. && pwd -P) + echo -n "$1" > "$_dir/tmp/.step" + unset _dir +} + +step_error() { + echo -e "\033[41;37m 步骤异常-> \033[0m $1 $2" + step_switch $2 + CURRENT_STEP=$1 + exit +} + +step_over() { + _dir=$(cd `dirname $0`/.. && pwd -P) + echo -n "" > "$_dir/tmp/.step" + unset _dir +} diff --git a/tools/update-wechat-devtools-bash b/tools/update-wechat-devtools-bash new file mode 100755 index 0000000..a9bf588 --- /dev/null +++ b/tools/update-wechat-devtools-bash @@ -0,0 +1 @@ +#!/bin/bash diff --git a/tools/update-wechat-devtools-node b/tools/update-wechat-devtools-node index e9f40fd..8c58210 100755 --- a/tools/update-wechat-devtools-node +++ b/tools/update-wechat-devtools-node @@ -201,97 +201,97 @@ const upgrade = function (extractPath) { }); }; -const patch_wechat_devtools_package_name = function () { - info("Patching wechat-devtools package name"); +// const patch_wechat_devtools_package_name = function () { +// info("Patching wechat-devtools package name"); - return new Promise((resolve, reject) => { - spawn(path.resolve(__dirname, "fix-package-name.js"), [], { - stdio: "inherit", - }).on("close", (code) => { - resolve(); - }); - }); -}; -const patch_wechat_devtools_editor_selection_autocopy = function () { - info("Patching wechat-devtools editor selection autocopy"); +// return new Promise((resolve, reject) => { +// spawn(path.resolve(__dirname, "fix-package-name.js"), [], { +// stdio: "inherit", +// }).on("close", (code) => { +// resolve(); +// }); +// }); +// }; +// const patch_wechat_devtools_editor_selection_autocopy = function () { +// info("Patching wechat-devtools editor selection autocopy"); - return new Promise((resolve, reject) => { - spawn(path.resolve(__dirname, "fix-selection-copy-node"), [], { - stdio: "inherit", - }).on("close", (code) => { - resolve(); - }); - }); -}; -const patch_wechat_devtools_CLI = function () { - info("Patching wechat-devtools CLI supports"); +// return new Promise((resolve, reject) => { +// spawn(path.resolve(__dirname, "fix-selection-copy-node"), [], { +// stdio: "inherit", +// }).on("close", (code) => { +// resolve(); +// }); +// }); +// }; +// const patch_wechat_devtools_CLI = function () { +// info("Patching wechat-devtools CLI supports"); - return new Promise((resolve, reject) => { - spawn(path.resolve(__dirname, "fix-cli.sh"), [], { - stdio: "inherit", - }).on("close", (code) => { - resolve(); - }); - }); -}; -const patch_wechat_devtools_core = function () { - info("Patching wechat-devtools core.wxvpkg"); +// return new Promise((resolve, reject) => { +// spawn(path.resolve(__dirname, "fix-cli.sh"), [], { +// stdio: "inherit", +// }).on("close", (code) => { +// resolve(); +// }); +// }); +// }; +// const patch_wechat_devtools_core = function () { +// info("Patching wechat-devtools core.wxvpkg"); - return new Promise((resolve, reject) => { - spawn(path.resolve(__dirname, "fix-core.sh"), [], { - stdio: "inherit", - }).on("close", (code) => { - resolve(); - }); - }); -}; -const rebuild_wechat_devtools_node_modules = function () { - info("Rebuilding wechat-devtools node modules"); +// return new Promise((resolve, reject) => { +// spawn(path.resolve(__dirname, "fix-core.sh"), [], { +// stdio: "inherit", +// }).on("close", (code) => { +// resolve(); +// }); +// }); +// }; +// const rebuild_wechat_devtools_node_modules = function () { +// info("Rebuilding wechat-devtools node modules"); - return new Promise((resolve, reject) => { - const nwConfig = require(path.resolve(__dirname, "../conf/nwjs.json")); - const e = spawn( - path.resolve(__dirname, "rebuild-node-modules.sh"), - [nwConfig.version], - { - stdio: "inherit", - } - ); - e.on("error", (code) => { - reject(code); - }); - e.on("close", (code) => { - console.info( - `Rebuilding wechat-devtools node modules Result Code: ${code}` - ); - if (0 === code) resolve(); - else { - reject(code); - } - }); - }); -}; -const patch_wechat_devtools = function () { - info("Patching wechat-devtools"); +// return new Promise((resolve, reject) => { +// const nwConfig = require(path.resolve(__dirname, "../conf/nwjs.json")); +// const e = spawn( +// path.resolve(__dirname, "rebuild-node-modules.sh"), +// [nwConfig.version], +// { +// stdio: "inherit", +// } +// ); +// e.on("error", (code) => { +// reject(code); +// }); +// e.on("close", (code) => { +// console.info( +// `Rebuilding wechat-devtools node modules Result Code: ${code}` +// ); +// if (0 === code) resolve(); +// else { +// reject(code); +// } +// }); +// }); +// }; +// const patch_wechat_devtools = function () { +// info("Patching wechat-devtools"); - return new Promise((resolve, reject) => { - const exec = spawn(path.resolve(__dirname, "fix-menu.sh"), [], { - stdio: "inherit", - }); - exec.on("close", (code) => { - resolve(); - }); - }); -}; -const patch_other = function () { - info("Patching Other"); +// return new Promise((resolve, reject) => { +// const exec = spawn(path.resolve(__dirname, "fix-menu.sh"), [], { +// stdio: "inherit", +// }); +// exec.on("close", (code) => { +// resolve(); +// }); +// }); +// }; +// const patch_other = function () { +// info("Patching Other"); - return new Promise((resolve, reject) => { - execSync(path.resolve(__dirname, "fix-other.sh")); +// return new Promise((resolve, reject) => { +// execSync(path.resolve(__dirname, "fix-other.sh")); - resolve(); - }); -}; +// resolve(); +// }); +// }; const start = async () => { try { @@ -299,13 +299,13 @@ const start = async () => { const localPath = await download(url); const extractPath = await extract(localPath); await upgrade(extractPath); - await patch_wechat_devtools_package_name(); - await patch_wechat_devtools_editor_selection_autocopy(); - await patch_wechat_devtools_CLI(); - await patch_wechat_devtools_core(); - await rebuild_wechat_devtools_node_modules(); - await patch_wechat_devtools(); - await patch_other(); + // await patch_wechat_devtools_package_name(); + // await patch_wechat_devtools_editor_selection_autocopy(); + // await patch_wechat_devtools_CLI(); + // await patch_wechat_devtools_core(); + // await rebuild_wechat_devtools_node_modules(); + // await patch_wechat_devtools(); + // await patch_other(); // 写入构建时间戳 fs.writeFileSync( path.resolve(__dirname, "../package.nw/.build_time"),