-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.sh
executable file
·60 lines (53 loc) · 1.35 KB
/
setup.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
#!/usr/bin/env bash
set -e
PATH_ROOT=${PWD}
PATH_COMM=${PATH_ROOT}/common/
PATH_RESS=${PATH_ROOT}/src/.vuepress/public/res/
PATH_NODE=${PATH_ROOT}/node_modules/
PRJ_NAME=${PATH_ROOT##*/}
if [ ! -f ${PATH_ROOT}/src/.vuepress/config-temp.ts ]; then
echo "Generating dynamic config..."
echo ""
cat > ${PATH_ROOT}/src/.vuepress/config-temp.ts << EOF
const config = {
// baseURL: "http://localhost:9090/api/"
baseURL: "https://ysyx.oscc.cc/api/"
};
export { config };
EOF
fi
if [ ! -d ${PATH_COMM} ]; then
echo "Downloading common scripts..."
rm -rf ${PATH_COMM}
git clone [email protected]:oscc-web/oscc-common.git ${PATH_COMM}
else
echo "Updating common scripts..."
cd ${PATH_COMM}
git pull origin main
cd ${PATH_ROOT}
fi
if [ ! -d ${PATH_RESS}/.git ]; then
echo ""
echo "Downloading resources..."
rm -rf ${PATH_RESS}
git clone [email protected]:oscc-web/${PRJ_NAME}-resources.git ${PATH_RESS}
else
echo ""
echo "Updating resources..."
cd ${PATH_RESS}
git pull origin main
cd ${PATH_ROOT}
fi
if [ ! -d ${PATH_NODE} ]; then
echo ""
echo "Downloading Node.js packages..."
npm install
# else
# echo ""
# echo -n "Do you want to update Node.js packages? [Y/n]: "
# read choice
# if [ ${choice} == "Y" ]; then
# npm install
# fi
# echo "Already up to date."
fi