-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-web.sh
executable file
·54 lines (46 loc) · 1.55 KB
/
build-web.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# http://docs.cocos.com/creator/manual/zh/publish/publish-in-command-line.html
debug=$1
md5Cache=$2
inlineSpriteFrames=$3
if [[ "$#" -eq 0 ]]; then
echo "参数均使用默认值:[debug=false,md5Cache=true,inlineSpriteFrames=true] ";
debug=false
md5Cache=true
inlineSpriteFrames=true
else
if [[ "$#" -ne 3 ]]; then
echo "必须带上3个参数:[debug=true|false,md5Cache=true|false,inlineSpriteFrames=true|false] ";
exit
fi
if [[ "$debug" != "false" && "$debug" != "true" ]]; then
echo "参数输入有误,debug只能传 [true,false] ";
exit
fi
if [[ "$md5Cache" != "false" && "$md5Cache" != "true" ]]; then
echo "参数输入有误,md5Cache只能传 [true,false] ";
exit
fi
if [[ "$inlineSpriteFrames" != "false" && "$inlineSpriteFrames" != "true" ]]; then
echo "参数输入有误,inlineSpriteFrames只能传 [true,false] ";
exit
fi
fi
ccp=$(which CocosCreator);
if [ -n "$ccp" ]; then
echo 'CocosCreator exist'
else
ccp="/Applications/CocosCreator.app/Contents/MacOS"
export PATH=$ccp":"$PATH
echo "Auto Exported CocosCreator Path:"$ccp
fi
ccwp=$PWD
buildp=$ccwp"/build"
rm -rf $buildp
CocosCreator --path $ccwp --build "platform=web-mobile;debug=${debug};md5Cache=${md5Cache};inlineSpriteFrames=${inlineSpriteFrames};webOrientation=portrait"
dist="${buildp}/web-mobile"
if [[ -d $dist ]]; then
echo "打包成功,开始替换启动动画"
/bin/cp ./custom-template/* build/web-mobile/
echo "启动动画替换完毕"
fi