-
Notifications
You must be signed in to change notification settings - Fork 1
/
reset-ui.sh
executable file
·55 lines (39 loc) · 1.21 KB
/
reset-ui.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
#!/bin/sh
set -e
# you have to run this script while you are in the root directory of the project
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
# Check if the user is in the osrd-ui folder
if [[ "$(pwd)" != *"/osrd-ui" ]]; then
echo -e "❌ ${YELLOW}You need to be in the osrd-ui folder to launch this script${NC}"
exit 1
fi
echo -e "${GREEN}Removing node_modules from the root directory${NC}"
rm -rf node_modules
if [ -f package-lock.json ]; then
echo -e "${YELLOW}Removing package-lock.json from the root directory${NC}"
fi
# create a list of all the osrd-ui sub-repos
sub_repos=$(ls -d ./ui-*)
# remove node_modules and dist from all the sub-repos
echo
echo -e "${GREEN}Removing node_modules and dist from:${NC}"
echo -e $sub_repos
for repo in $sub_repos; do
echo
echo -e "${GREEN}Removing node_modules and dist from $repo ${NC}"
rm -rf $repo/node_modules
if [ -f $repo/package-lock.json ]; then
echo -e "${YELLOW}Removing package-lock.json from $repo ${NC}"
fi
rm -rf $repo/dist
done
# install packages in the root directory
echo
echo -e "${GREEN}Installing packages in the root directory${NC}"
npm install
# build the root directory
echo
echo -e "${GREEN}Building the root directory${NC}"
npm run build