-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.sh
executable file
·60 lines (46 loc) · 1.28 KB
/
doc.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
58
59
60
#!/bin/bash
set -eu
DOC_VERSION=6
DOC_PATH=/sdk/js/6
# Used by vuepress
export DOC_DIR=$DOC_VERSION
export SITE_BASE=$DOC_PATH/
# Used to specify --clean-cache for example
ARGS=${2:-""}
if [ ! -d "./$DOC_DIR" ]
then
echo "Cannot find $DOC_DIR/. You must run this script from doc/ directory."
exit 1
fi
case $1 in
prepare)
echo "Clone documentation framework"
rm -rf framework
git clone --depth 10 --single-branch --branch master https://github.com/kuzzleio/documentation.git framework/
echo "Link local doc for dead links checking"
rm framework/src$DOC_PATH
ln -s ../../../../$DOC_VERSION framework/src$DOC_PATH
echo "Install dependencies"
npm --prefix framework/ install
;;
dev)
./framework/node_modules/.bin/vuepress dev $DOC_VERSION/ $ARGS
;;
build)
./framework/node_modules/.bin/vuepress build $DOC_VERSION/ $ARGS
;;
build-netlify)
export SITE_BASE="/"
./framework/node_modules/.bin/vuepress build $DOC_VERSION/ $ARGS
;;
upload)
aws s3 sync $DOC_VERSION/.vuepress/dist s3://$S3_BUCKET$SITE_BASE --delete
;;
cloudfront)
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "$SITE_BASE*"
;;
*)
echo "Usage : $0 <prepare|dev|build|upload|cloudfront>"
exit 1
;;
esac