-
Notifications
You must be signed in to change notification settings - Fork 20
/
scripts.sh
executable file
·73 lines (60 loc) · 1.27 KB
/
scripts.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# All package scripts to not polute
# package.json file with long scripts
cmd=$1
args=${@:2}
function dev() {
echo "🚀 Starting dev server...";
npx rollup -c --watch;
};
function build() {
clean;
echo "📦 Building package...";
npx rollup -c;
};
function prepare() {
echo "👋 Installing git hooks...";
npx simple-git-hooks >> /dev/null;
build;
};
function test() {
echo "🧪 Running tests...";
npx vitest --dir ./src --run --coverage;
};
function lint() {
echo "🧹 Linting...";
npx eslint ./src --ext ts,tsx;
};
function clean() {
echo "🧹 Cleaning up...";
rm -rf dist;
};
function postinstall() {
echo "👋 Running patches...";
npx patch-package;
};
function hello() {
echo "👋 Hello!" $args;
};
function example() {
echo "👋 Select your example project to run: ";
examples="$(ls ./examples)";
select example in $examples; do
if [ -n "$example" ]; then
build;
echo "🚀 Starting $example...";
cd ./examples/$example;
# if example is cra, run npm start
# else run npm run dev
if [ "$example" = "cra" ]; then
npm start;
else
npm run dev;
fi
break;
else
echo "👋 Select your example project to run: ";
fi
done
};
eval $cmd $args