-
Notifications
You must be signed in to change notification settings - Fork 0
/
.scrub.sh
executable file
Β·41 lines (34 loc) Β· 1.38 KB
/
.scrub.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
#!/bin/bash
# Scrubs the projec to sterilize it for a fresh start
#############################################################
GREEN='\033[0;32m' #green
YELLOW='\033[33m' #yellow
WHITE='\033[97m' #white
GRAY='\033[37m' #light gray
NC='\033[0m' #no-color
BOLD='\033[1m' #bold
BOLDEND='\033[0m' #bold end
TITLE="π§Ό Scrubbed "
OPTIONS="${YELLOW}site${NC}, or ${YELLOW}purge${NC}"
OOPS="ππ₯π₯ OOPS! We need a valid option β Try using ${OPTIONS}"
MALFUNCTION="π¨βπ Huston... We have a problem! Make sure you use ${OPTIONS} - "
SITE="${WHITE}${BOLD}output${BOLDEND}${NC} & ${WHITE}${BOLD}all cache${BOLDEND}${NC} directories β¨"
FRESH="${WHITE}${BOLD}node_modules${BOLDEND}${NC}, ${WHITE}${BOLD}lock files${BOLDEND}${NC}, ${SITE}"
PURGE="π§Ή ${GREEN}${BOLD}All Clean${BOLDEND}${NC} β¨ ${TITLE}${FRESH}${NC}\n\nRun ${YELLOW}${BOLD}bun/pnpm install${BOLDEND}${NC} to start fresh π€©"
DEVFILES="dist/ _site/ .cache/ *.log"
NODEFILES="node_modules package-lock.json pnpm-lock.yaml yarn.lock .yarn/ bun.lockb deno.lock"
#################### DONT EDIT BELOW π ####################
if [ $# -eq 0 ]
then
echo -e "$MALFUNCTION"
elif [ "$1" == "site" ]
then
(rm -rf ${DEVFILES} || del ${DEVFILES})
echo -e ${TITLE}${SITE}
elif [ "$1" == "purge" ]
then
(rm -rf ${DEVFILES} ${NODEFILES} || del ${DEVFILES} ${NODEFILES})
echo -e ${PURGE}
else
echo -e "$OOPS"
fi