-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathbuildDocsForProduction
executable file
·50 lines (40 loc) · 1.37 KB
/
buildDocsForProduction
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
#!/bin/bash
RED='\033[0;31m'
NC='\033[0m' # No color
YELLOW='\033[33m'
GREEN='\033[32m'
ignore_error="$1"
# Clear docusaurus cache before building
npx docusaurus clear .
if [[ $ignore_error != "true" ]]
then
MODE=production npx docusaurus build
if [[ $? -ne 0 ]]
then
echo "build failed... exiting!"
exit 1
fi
else
MODE=production CODE_TYPE_CHECK=nothing npx docusaurus build
fi
echo "Copying to supertokens-backend-website..."
# remove unnecessary files
rm ./build/index.html
rm ./build/blog.html
rm ./build/404.html
rm ./build/.nojekyll
# updating search page url on documention with the correct path.
sed -i '' '/supertokens\.com\/img/!s/supertokens\.com/supertokens.com\/docs/g' ./build/opensearch.xml
mv ./build/opensearch.xml ./build/docs
# copy build folder to proper location
# Check if folder exists
if [ ! -d ../../supertokens-backend-website/app/docs/v2 ]; then
# folder does not exist, probably a new docs project and the folder hasnt been created before running this
echo -e "${YELLOW}creating directory supertokens-backend-website/app/docs/v2 since it does not exist${NC}"
mkdir ../../supertokens-backend-website/app/docs/v2
fi
# remove current content
rm -rf ../../supertokens-backend-website/app/docs/v2/*
# copy everything inside the build directory
cp -r ./build/* ../../supertokens-backend-website/app/docs/v2/
echo "Done!"