-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcs
101 lines (98 loc) · 2.67 KB
/
cs
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
command=$1
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
CLIENT_DIR=$ROOT_DIR/client
SERVER_DIR=$ROOT_DIR/server
DONE="--------- DONE ---------"
if [ "$command" = "" ]; then
echo "No command provided."
echo "Hint: try \"cs help\""
elif [ "$command" = "install" ]; then
cd $CLIENT_DIR
npm install
cd $SERVER_DIR
npm install
echo $DONE
elif [ "$command" = "pretty" ]; then
cd $CLIENT_DIR
npm run pretty
cd $SERVER_DIR
npm run pretty
echo $DONE
elif [ "$command" = "lint" ]; then
cd $CLIENT_DIR
npm run lint
cd $SERVER_DIR
npm run lint
echo $DONE
elif [ "$command" = "lint-fix" ]; then
cd $CLIENT_DIR
npm run lint-fix
cd $SERVER_DIR
npm run lint-fix
echo $DONE
elif [ "$command" = "csf" ]; then
cd $CLIENT_DIR
npm run pretty
npm run lint-fix
cd $SERVER_DIR
npm run pretty
npm run lint-fix
echo $DONE
elif [ "$command" = "update" ]; then
cd $CLIENT_DIR
npm update
cd $SERVER_DIR
npm update
echo $DONE
elif [ "$command" = "dev" ]; then
cd $SERVER_DIR
npm run dev
elif [ "$command" = "build" ]; then
cd $CLIENT_DIR
npm run build-only
cd $SERVER_DIR
npm run build
echo $DONE
elif [ "$command" = "serve" ]; then
cd $SERVER_DIR
npm run serve
elif [ "$command" = "help" ]; then
divider="|---------------------------------------------------------------------|"
echo "|---------------- CommandScript Development Toolkit ------------------|"
echo "| -- install"
echo "| - Installs projects dependencies for both the client and server."
echo $divider
echo "| -- update"
echo "| - Updates the project dependencies for both the client and server."
echo $divider
echo "| -- dev"
echo "| - Starts the development server for both the client and server."
echo $divider
echo "| -- build"
echo "| - Builds the project for production."
echo $divider
echo "| -- serve"
echo "| - Serves the production build."
echo $divider
echo "| -- pretty"
echo "| - Reformats the codebase."
echo $divider
echo "| -- lint"
echo "| - Lints the codebase"
echo $divider
echo "| -- lint-fix"
echo "| - Lints the codebase and fixes any fixable issues."
echo $divider
echo "| -- csf"
echo "| - Pretty formats the codebase and lints it."
echo $divider
echo "| -- generate-dep-md"
echo "| - Generates a markdown table for the project dependencies."
echo $divider
elif [ "$command" = "generate-dep-md" ]; then
node $ROOT_DIR/@tools/generate-dep-md.js
else
echo "Invalid command."
echo "Hint: try \"cs help\""
fi