forked from n4bb12/verdaccio-github-oauth-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run
executable file
·104 lines (88 loc) · 1.69 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
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
set -e
#
# Helpers
##################################################
red="\e[31m"
reset="\e[39m"
run() {
task=${1}
shift
echo -e [${task}] ${@}
${@}
}
fail() {
echo -e ${red}${@}${reset}
exit 1
}
#
# Commands
##################################################
linkdir=node_modules/verdaccio-gitlab-oauth
config=verdaccio.yaml
#
# Build server, config and client
#
build() {
run build node rollup.js
run build cp -R src/client/*.css dist/public
}
#
# Remove the plugin from node_modules
#
clear() {
run clear rm -rf dist
run clear rm -rf $linkdir
}
#
# Copy the built plugin to node_modules
#
link() {
run link mkdir -p $linkdir/
run link cp -R dist $linkdir/
run link cp package.json $linkdir/
run link cp verdaccio.yaml $linkdir/
}
#
# Update client and server
#
update() {
clear
build
link
}
#
# Start verdaccio
#
start() {
run start yarn verdaccio -c $config ${@}
}
#
# Watch for changes, rebuild and update
#
watch() {
run watch yarn nodemon --watch src --ext ts,css --exec bash run update
}
#
# Run linters
#
lint() {
run lint yarn tsc --project src/client/tsconfig.json --noEmit
run lint yarn tsc --project src/server/tsconfig.json --noEmit
run lint yarn tslint -c tslint.json -p src/client/tsconfig.json ${@}
run lint yarn tslint -c tslint.json -p src/server/tsconfig.json ${@}
}
#
# CLI
##################################################
#
# Call the function specified by the first parameter, passing all remaining
# parameters to the function. If no such function exists, display usage info.
#
if [ -n "$1" ] && type $1 | grep -i function > /dev/null; then
command="$1"
shift
$command ${@}
else
fail "No such command: $1"
fi