forked from ng-alain/delon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.sh
57 lines (40 loc) · 1.21 KB
/
site.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
55
56
57
#!/usr/bin/env bash
set -u -e -o pipefail
readonly currentDir=$(cd $(dirname $0); pwd)
cd ${currentDir}
BUILD=false
DEPLOY=false
for ARG in "$@"; do
case "$ARG" in
-d)
DEPLOY=true
;;
-b)
BUILD=true
;;
esac
done
echo 'BUILD(-b):' $BUILD ', DEPLOY(-d):' $DEPLOY
if [[ ${BUILD} == true ]]; then
echo 'Generate site...'
$(npm bin)/gulp site:gen
echo 'Generate site color less...'
rm -rf .tmp
cp -r packages .tmp
sed -e "s/~ng-zorro-antd/..\/..\/..\/node_modules\/ng-zorro-antd/g" packages/theme/styles/default.less > .tmp/theme/styles/default.less
sed -e "s/~ng-zorro-antd/..\/..\/..\/..\/..\/node_modules\/ng-zorro-antd/g" packages/theme/styles/app/mixins/index.less > .tmp/theme/styles/app/mixins/index.less
node ./scripts/site/generate-color-less.js
rm -rf .tmp
echo 'build...'
$(npm bin)/ng build --app site --prod --build-optimizer --bh /
fi
if [[ ${DEPLOY} == true ]]; then
echo 'copy index.html > 404.html'
cp -f site/dist/index.html site/dist/404.html
echo 'copy CNAME'
cp -f site/CNAME site/dist/CNAME
echo 'deploy by gh-pages'
$(npm bin)/gh-pages-clean
$(npm bin)/gh-pages -d site/dist
fi
echo 'FINISHED!'