2022-02-16 11:18:38 +08:00

40 lines
1.7 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
root_dir=$(cd `dirname $0`/.. && pwd -P)
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"
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
# 预览编译
# cd "${package_dir}/js/vendor/" && rm -rf "wcc.exe"
# cp "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcc" "${package_dir}/js/vendor/wcc.exe"
# wcc_md5=$( md5sum wcc.exe|cut -d ' ' -f1 ) && \
# sed -i 's/wcc.exe": ".*"/wcc.exe": "'"${wcc_md5}"'"/g' "config.json"
# cd "${package_dir}/js/vendor/" && rm -rf "wcsc.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" && \
# 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 "${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" \
&& cp -r "${srcdir}/compiler/wcc_node"/* "wcc" \
&& cp -r "${srcdir}/compiler/wcsc_node"/* "wcsc"
)
rm -rf "$tmp_dir/node_modules"