forked from rescript-react-native/rescript-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-docs.sh
More file actions
48 lines (41 loc) · 939 Bytes
/
build-docs.sh
File metadata and controls
48 lines (41 loc) · 939 Bytes
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
#!/bin/bash
PKG=BsReactNative
DOCS=docs
ODOC=$(which odoc)
LIB=./lib/bs/src
PAGES=./docs/pages
# Gather the sources to compile .odoc files
CMT_FILES=$(find ${LIB} -name "*.cmti")
MLD_FILES=$(find ${PAGES} -name "*.mld")
echo "<< Compiling module docs..."
for file in ${CMT_FILES}; do
${ODOC} compile \
-I ${LIB} \
--pkg=${PKG} \
--resolve-fwd-refs \
${file}
done
echo ">> Done!"
echo "<< Compiling page docs..."
for file in ${MLD_FILES}; do
odoc_file=$( echo $(basename ${file}) | sed "s/mld/odoc/")
${ODOC} compile \
-I ${LIB} \
--pkg=${PKG} \
--resolve-fwd-refs \
-o ${LIB}/${odoc_file} \
${file}
done
echo ">> Done!"
# Now we can look for the compiled .odoc files
ODOC_FILES=$(find ${LIB} -name "*.odoc")
echo "<< Generating HTML..."
for file in ${ODOC_FILES}; do
${ODOC} html \
-I ${LIB} \
-o ${DOCS} \
--syntax=re \
--semantic-uris \
${file}
done
echo ">> Done!"