-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvitejs.sh
59 lines (50 loc) · 1.26 KB
/
vitejs.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
if ! is_bin_in_path node; then
SF_WARNS+=("[vitejs plugin]: $(__sf_missing_binary_message 'nodejs')")
return
fi
#
# FUNCTIONS
#
npvi() {
local args_number=$#
local npm_v
local dir_name="${2}"
local template="${1}"
if ((args_number == 0)); then
npm create vite@latest
elif ((args_number == 2)); then
npm_v=$(npm --version)
npm_v_mj="${npm_v:0:1}"
if ((npm_v_mj == 6)); then
npm create vite@latest "${dir_name}" --template "${template}"
else
npm create vite@latest "${dir_name}" -- --template "${template}"
fi
else
echo -e "${LIGHTRED}[ SHELL-FNS ]: ERROR - Expected 0 or 2 arguments"
fi
}
yavi() {
local args_number=$#
local dir_name="${2}"
local template="${1}"
if ((args_number == 0)); then
yarn create vite
elif ((args_number == 2)); then
yarn create vite "${dir_name}" --template "${template}"
else
echo -e "${LIGHTRED}[ SHELL-FNS ]: ERROR - Expected 0 or 2 arguments"
fi
}
pnvi() {
local args_number=$#
local dir_name="${2}"
local template="${1}"
if ((args_number == 0)); then
pnpm create vite
elif ((args_number == 2)); then
pnpm create vite "${dir_name}" --template "${template}"
else
echo -e "${LIGHTRED}[ SHELL-FNS ]: ERROR - Expected 0 or 2 arguments"
fi
}