This repository was archived by the owner on Feb 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.sh
More file actions
54 lines (48 loc) · 1.25 KB
/
script.sh
File metadata and controls
54 lines (48 loc) · 1.25 KB
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
#!/bin/bash
TYPE=$1
APP_NAME=$2
OPEN=$3
scriptDir=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")")
if [ "$APP_NAME" == "" ] & [ "$TYPE" == "" ]; then
mkdir $APP_NAME;
cd $APP_NAME;
exit;
fi
if [ "$APP_NAME" != "." ] & [ "$APP_NAME" != "" ]; then
mkdir $APP_NAME;
cd $APP_NAME;
fi
if [ "$OPEN" == "open" ]; then
code .;
fi
git init;
case $TYPE in
"react")
npm create vite@latest -- --template react .;
npm i;
cp $scriptDir/.gitignore .;
touch .env;
;;
"react-node")
mkdir frontend;
cd frontend;
npm create vite@latest -- --template react .;
npm i;
cd ..;
mkdir backend;
cd backend;
cp -r $scriptDir/node/* .;
npm i express dotenv express-async-handler;
cd ..;
cp $scriptDir/.gitignore .;
;;
"node")
cp -r $scriptDir/node/* .;
cp $scriptDir/.gitignore .;
npm i express dotenv express-async-handler;
;;
"vanilla")
cp -r $scriptDir/vanilla/* . && cp $scriptDir/.gitignore .;
;;
*) echo "Invalid option $TYPE";;
esac