build_web.sh
1.23 KB
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
#!/bin/bash
org_dir=`pwd`
script_dir=$(cd `dirname $0`; pwd)
prj_name=code-serv
src_dir=$script_dir/../code/finance_web
if [ $# != 1 ]; then
echo Usage: $0 web_dir
exit 1
fi
web_dir=$1
echo "cd $src_dir"
cd $src_dir
cp $src_dir/build/webpack.base.conf.js $script_dir/webpack.base.conf.js.original
echo "replace webpack.base.conf.js by release version"
cp $script_dir/webpack.base.conf.js.release $src_dir/build/webpack.base.conf.js
sed -i "s/PH_WEB_DIR/$web_dir/g" $src_dir/build/webpack.base.conf.js
# process main.js
cp $src_dir/src/main.js $script_dir/main.js.org
#sed -i "s/Vue\.prototype\.IP\s*\=.*/Vue\.prototype\.IP\=\'http:\/\/$ip_addr\:20080\'\;/g" $src_dir/src/main.js
#sed -i "s/Vue\.prototype\.downUrl\s*\=.*/Vue\.prototype\.downUrl\=\'http:\/\/$ip_addr\:20080\'\;/g" $src_dir/src/main.js
#######
#echo "============= start building new files.================"
npm run build
echo "replace webpack.base.conf.js by develop version"
mv $script_dir/webpack.base.conf.js.original $src_dir/build/webpack.base.conf.js
mv $script_dir/main.js.org $src_dir/src/main.js
dist_dir=$script_dir/../web/dist/finance
rm -rf $script_dir/../deploy_web/dist/finance
cp -r $dist_dir $script_dir/../deploy_web/finance
echo "cd $org_dir"
cd $org_dir