diff --git a/tools/fix-selection-copy-node b/tools/fix-selection-copy-node index 95db925..5cbb440 100755 --- a/tools/fix-selection-copy-node +++ b/tools/fix-selection-copy-node @@ -7,12 +7,10 @@ const { execSync } = require("child_process"); console.info("Patching editor selection copy configs"); let configPath = os.homedir() + "/.config/wechat_devtools/Default/Editor/User/settings.json"; -let config = undefined; +let config = {}; if (fs.existsSync(configPath)) { // console.info(configPath) config = JSON.parse(fs.readFileSync(configPath, "utf8")); -} else { - config = {}; } config["editor.selectionClipboard"] = false; diff --git a/tools/rebuild-node-modules.sh b/tools/rebuild-node-modules.sh index 62c651e..c6a1939 100755 --- a/tools/rebuild-node-modules.sh +++ b/tools/rebuild-node-modules.sh @@ -52,8 +52,18 @@ mkdir -p tmp && cd tmp # notice "非ACTION模式, 设置镜像源" # export https_proxy="http://127.0.0.1:7890" # fi -wget https://github.com/microsoft/ripgrep-prebuilt/releases/download/v12.1.1-1/ripgrep-v12.1.1-1-x86_64-unknown-linux-musl.tar.gz -O ripgrep-v12.1.1-1-x86_64-unknown-linux-musl.tar.gz -tar xvf ripgrep-v12.1.1-1-x86_64-unknown-linux-musl.tar.gz -C ../bin && \ + +# ripgrep版本 +ripgrep_version="12.1.1-1" +# ripgrep路径 +ripgrep_path="$root_dir/cache/ripgrep-v${ripgrep_version}-x86_64-unknown-linux-musl.tar.gz" +# 文件不存在,下载 +if [ ! -f "$ripgrep_path" ];then + wget https://github.com/microsoft/ripgrep-prebuilt/releases/download/v12.1.1-1/ripgrep-v12.1.1-1-x86_64-unknown-linux-musl.tar.gz \ + -O "${ripgrep_path}.tmp" + mv "${ripgrep_path}.tmp" "${ripgrep_path}" +fi +tar xvf "$ripgrep_path" -C ../bin && \ cd .. && rm -rf tmp (cd "${package_dir}/node_modules" && \ @@ -112,6 +122,7 @@ find -name "*.a" -delete && \ find -name "*.lib" -delete && \ find -name "*.mk" -delete) +# TODO: 检查路径包含空格时,是否正常 notice "copy node files" (cd "${package_dir}/node_modules_tmp/node_modules" && \ find -name "*.node" | xargs -I{} \cp -rf {} ${package_dir}/node_modules/{}) diff --git a/tools/setup-wechat-devtools-bash b/tools/setup-wechat-devtools-bash index c0a8cf7..85c9077 100755 --- a/tools/setup-wechat-devtools-bash +++ b/tools/setup-wechat-devtools-bash @@ -52,11 +52,13 @@ if [ $CURRENT_STEP == $INSTALL_START ];then fi # 将node加入环境 -export PATH="$root_dir/node/bin":$PATH +export PATH="$root_dir/cache/npm/node_global/bin:$root_dir/node/bin:$PATH" node --version npm --version if [ $CURRENT_STEP == $INSTALL_NODE_SUCCESS ];then + npm config set prefix "$root_dir/cache/npm/node_global" + npm config set cache "$root_dir/cache/npm/node_cache" if [ "$ACTION_MODE" != "true" ]; then notice "非ACTION模式, 设置镜像源" npm config set registry http://registry.npmmirror.com/ # 注册模块镜像 @@ -79,6 +81,7 @@ 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 + echo $PATH node-gyp install node-gyp list step_switch $INSTALL_GYP_SUCCESS