-
Notifications
You must be signed in to change notification settings - Fork 1
/
lintHook.sh
executable file
·53 lines (44 loc) · 1.13 KB
/
lintHook.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
#!/bin/bash
path=$1
#
# Use the optional --continue flag to run Gulp without breaking on warnings/errors
#
continueFlag=$2
if [ -z "$path" ] || [ ! -d "$path" ]; then
echo "usage: ./lintHook.sh pathProjectRoot"
echo "for example: ./lintHook.sh \$PWD"
exit
fi
if [ -f ~/.nvm/nvm.sh ]; then
. ~/.nvm/nvm.sh
fi
echo "====== Running linters ======="
nvm use 20
for app in admin
do
echo "=== $app start ==="
cd $path/resources/assets/$app
if [ -f package.json ]; then
find . -maxdepth 1 -name package.json | grep package > /dev/null 2>&1
if [ $? == 0 ]; then
echo "= PNPM install ="
pnpm install --frozen-lockfile --no-color
if [ $? != 0 ]; then
exit 1
fi
fi
echo "= Lint ="
npm run lint --no-ansi --no-color
if [ $? != 0 ]; then
exit 1
fi
if [ $app == admin ]; then
echo "= Copy paste detector ="
npm run cpd --no-ansi --no-color
fi
else
echo "Package.json doesn't exist"
fi
done
nvm use default
echo "================================="