Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit 3725674

Browse files
author
炒饭
committed
增加更新脚本
1 parent f7080a9 commit 3725674

File tree

6 files changed

+72
-55
lines changed

6 files changed

+72
-55
lines changed

bin/build.conf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
wechat_v="0.15.152900"
2-
#nwjs_v="0.21.3"
3-
1+
wechat_v="0.17.170900"
42
nwjs_v="0.19.4"

bin/pack.sh

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,68 @@
1-
#! /bin/sh
2-
# tar wechat-dev-tools
1+
#! /bin/bash
2+
# 下载nwjs,构建项目,支持以下选项
3+
# pack - 打包
4+
# install - 构建,并且执行scripts/replace_weapp_vendor.sh
5+
# build - 可以使用,但不执行scripts/replace_weapp_vendor.sh
36

4-
param1=${1:-"pack"}
5-
echo $param1
7+
want=${1:-"build"}
8+
if [ $want = "install" -o $want = "build" -o $want = "pack" ]; then
9+
echo $want
10+
else
11+
echo "不支持$want操作"
12+
exit 127
13+
fi
614

715
cd `dirname $0`/..
816

9-
cur_dir=$(pwd)
17+
root_dir=$(pwd)
1018

11-
. "$cur_dir/bin/build.conf"
19+
. "$root_dir/bin/build.conf"
1220

13-
tmp_dir="$cur_dir/.tmp"
14-
dist_dir="$cur_dir/dist"
21+
tmp_dir="$root_dir/.tmp"
22+
dist_dir="$root_dir/dist"
1523

1624
nwjs_file="$tmp_dir/nwjs-v$nwjs_v.tar.gz"
1725
nwjs_dir="$tmp_dir/nwjs-sdk-v${nwjs_v}-linux-x64"
1826
nwjs_download="https://dl.nwjs.io/v$nwjs_v/nwjs-sdk-v${nwjs_v}-linux-x64.tar.gz"
1927

20-
dist_wechat_dir="wechat-dev-tools-xsp"
2128
dist_wechat_package="wechat-v${wechat_v}-nwjs-v${nwjs_v}.tar.gz"
2229

23-
if [ $param1 = "install" ]; then
24-
echo "install"
25-
# rm -rf $tmp_dir
26-
fi
27-
2830
mkdir -p $tmp_dir
2931
if [ ! -d "$nwjs_dir" ]; then
3032
if [ ! -f "$nwjs_file" ]; then
3133
echo "================================="
3234
echo "[注意]需要下载nwjs.请耐心等待下载完成"
33-
echo $nwjs_download
35+
echo "$nwjs_download"
3436
echo "================================="
35-
wget "$nwjs_download" -O $nwjs_file
37+
wget "$nwjs_download" -O "$nwjs_file"
3638
$? -ne 0 && exit "$?"
3739
fi
3840

39-
tar -xf $nwjs_file -C $tmp_dir
41+
tar -xf "$nwjs_file" -C $tmp_dir
4042
$? -ne 0 && exit "$?"
4143
cd "$nwjs_dir/locales" || exit "$?"
42-
rm $(ls -I "zh*" -I "en*" )
43-
cd "$cur_dir"
44+
# 移除其他语言
45+
ls -I "zh*" -I "en*" | xargs rm
46+
cd "$root_dir"
4447
fi
4548

46-
rm -rf $cur_dir/dist
47-
mkdir -p $cur_dir/dist
49+
rm -rf "$dist_dir"
50+
mkdir -p "$dist_dir"
51+
52+
cp -r "$nwjs_dir"/* "$root_dir/scripts" "$dist_dir"
4853

49-
if [ $param1 = "install" ]; then
50-
cp -r "$nwjs_dir"/* "$cur_dir/scripts" "$cur_dir/dist"
51-
cd "$cur_dir/dist"
52-
ln -s "$cur_dir/package.nw"
53-
sh scripts/install.sh
54-
elif [ $param1 = "build" ]; then
55-
cp -r "$nwjs_dir"/* "$cur_dir/scripts" "$cur_dir/dist"
56-
cd "$cur_dir/dist"
57-
ln -s "$cur_dir/package.nw"
58-
elif [ $param1 = "pack" ]; then
59-
cp -r "$nwjs_dir"/* "$cur_dir/package.nw" "$cur_dir/scripts" "$cur_dir/dist"
60-
mkdir -p $tmp_dir/build
61-
tar -zcvf "$tmp_dir/build/$dist_wechat_package" -C "$cur_dir" dist
54+
if [ $want = "pack" ]; then
55+
cp -r "$root_dir/package.nw" "$dist_dir"
56+
mkdir -p "$tmp_dir/build"
57+
tar -zcvf "$tmp_dir/build/$dist_wechat_package" -C "$root_dir" dist
6258
else
63-
echo "不支持$param1操作"
64-
exit 127
59+
ln -s "$root_dir/package.nw"
60+
if [ $want = "install" ]; then
61+
sh "$dist_dir/scripts/replace_weapp_vendor.sh"
62+
fi
6563
fi
66-
echo "$param1 success"
6764

65+
echo "================================="
66+
echo "$want success"
67+
echo "可以手动删除目录下.tmp文件夹"
68+
echo "================================="

bin/update_package_nw.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#! /bin/bash
2+
3+
cd `dirname $0`/..
4+
5+
root_dir=$(pwd)
6+
7+
. "$root_dir/bin/build.conf"
8+
9+
tmp_dir="$root_dir/.tmp"
10+
dist_dir="$root_dir/dist"
11+
12+
wcwd_file="$tmp_dir/wechat_web_devtools_${wechat_v}_x64.exe"
13+
wcwd_download="https://dldir1.qq.com/WechatWebDev/${wechat_v//./}/wechat_web_devtools_${wechat_v}_x64.exe"
14+
15+
wcwd_package_dir="$HOME/.wine/drive_c/Program Files (x86)/Tencent/微信web开发者工具/package.nw"
16+
17+
mkdir -p $tmp_dir
18+
19+
# 下载
20+
if [ ! -f "$wcwd_file" ]; then
21+
echo "================================="
22+
echo "[注意]需要下载微信开发者工具.请耐心等待下载完成"
23+
echo $wcwd_download
24+
echo "================================="
25+
wget "$wcwd_download" -O $wcwd_file
26+
$? -ne 0 && exit "$?"
27+
fi
28+
29+
# 安装
30+
wine $wcwd_file
31+
32+
rm -rf "$root_dir/package.nw"
33+
cp -r "$wcwd_package_dir" "$root_dir"

note.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

replace.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)