-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
95 lines (75 loc) · 1.75 KB
/
run
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
#!/bin/bash
set -o errexit
if [ -d "./node_modules/.bin" ]; then
export PATH="./node_modules/.bin:$PATH"
fi
function setup() {
echo -e "🔄 updating asdf…\n"
asdf update
echo -e ""
echo -e "🔄 updating asdf's plugins…\n"
asdf plugin update nodejs
echo -e ""
echo -e "⬇️ installing asdf's packages…\n"
asdf install
echo -e ""
echo -e "🔄 updating npm…\n"
npm up npm --global
echo -e ""
echo -e "⬇️ installing packages with npm…\n"
npm ci
}
function cleanup() {
echo -e "🗑️ deleting './node_modules' folder…\n"
rm -rf ./node_modules
echo -e ""
echo -e "🗑️ deleting './package-lock.json' file…\n"
rm ./package-lock.json
echo -e ""
echo -e "⬇️ installing packages with npm…\n"
npm install
}
function execute() {
echo -e "▶ executing '$1' script…\n"
bash run $1 | sed 's/^/ /'
echo -e "\n✅ '$1' script was completed!"
}
function doc() {
echo -e "🤖 generating documentation with Typedoc…\n"
typedoc "./src/index.ts"
}
function test() {
echo -e "🧪 executing unit tests with Vitest…\n"
vitest ${@:1}
}
function type-check() {
echo -e "🔍 type checking with TypeScript…\n"
tsc --project ./tsconfig.json --noEmit
}
function lint() {
echo -e "🔎 linting code style with ESLint and Prettier…\n"
eslint
}
function check() {
execute lint
echo ""
execute type-check
}
function autofix() {
echo -e "👨🔧 automatically fixing source code with ESLint…\n"
eslint "*/**/*.{ts,js,json}" --fix
}
function bundle() {
echo -e "📦 bundling source code with Rollup…\n"
rollup --config ./rollup.config.mjs
}
function prepublish-only() {
execute doc
echo ""
execute check
echo ""
execute test
echo ""
execute bundle
}
eval "$@"