-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·58 lines (48 loc) · 997 Bytes
/
build.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
#!/usr/bin/env bash
SDK_DIR="../comit-js-sdk"
DEST_DIR="docs/comit-sdk/"
function sdk_exists() {
if [ -d $SDK_DIR ]; then
echo "☺ comit-js-sdk found."
return 0
else
echo "☹ ERROR: comit-js-sdk not found."
return 1
fi
}
function docs_exists() {
if [ -d $SDK_DIR/docs ]; then
echo "☺ SDK docs found."
return 0
else
echo "☹ ERROR: SDK docs not found."
return 1
fi
}
function generate_docs() {
echo "☺ Generating SDK docs."
cd $SDK_DIR
npm run docs:md
cd -
}
function generate_sidebar() {
echo "☺ Generating updated sidebar."
cp $SDK_DIR/website/sidebars.js $PWD/sidebars.temp.js
node ./generateSidebar.js
rm $PWD/sidebars.temp.js
}
import_docs() {
echo "☺ Importing SDK docs."
rm $SDK_DIR/docs/globals.md
rm -rfv $DEST_DIR && mkdir $DEST_DIR
cp -R $SDK_DIR/docs/. $DEST_DIR
}
# Main script
if sdk_exists; then
generate_docs
fi
if docs_exists; then
import_docs
generate_sidebar
echo "Finished."
fi