forked from web3/web3.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverdaccio.sh
executable file
·98 lines (82 loc) · 2.14 KB
/
verdaccio.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
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
#!/usr/bin/env bash
ORIGARGS=("$@")
helpFunction() {
echo "Usage: $0 [start|stop|publish|startAndPublish] [background]"
exit 1 # Exit script after printing help
}
start() {
. scripts/env.sh
if [[ ${ORIGARGS[1]} == "background" ]]; then
startBackground
else
echo "Starting verdaccio..."
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
fi
}
startBackground() {
echo "Starting verdaccio in background..."
docker run -d --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
}
stop() {
echo "Stopping verdaccio ..."
docker ps -q --filter ancestor="verdaccio/verdaccio" | xargs -r docker stop
}
createVerdaccioNPMUser() {
curl -XPUT \
-H "Content-type: application/json" \
-d '{ "name": "test", "password": "test" }' \
'http://localhost:4873/-/user/org.couchdb.user:test'
}
loginNPMUser() {
npx npm-auth-to-token \
-u test \
-p test \
-e test@test.com \
-r http://localhost:4873
}
lernaUpdatePackageVersions() {
npx lerna version 5.0.0 \
--ignore-scripts \
--no-push \
--no-private \
--no-git-tag-version \
--yes
}
lernaBuildAndCommit() {
yarn build
git add .
git commit -m "Comitting for black box publish"
}
lernaPublish() {
npx lerna publish from-package \
--dist-tag blackbox \
--no-git-tag-version \
--no-push \
--registry http://localhost:4873 \
--ignore-scripts \
--yes
}
publish() {
echo "Publishing to verdaccio ..."
npx wait-port -t 60000 4873
createVerdaccioNPMUser
loginNPMUser
lernaUpdatePackageVersions
lernaBuildAndCommit
lernaPublish
}
startBackgroundAndPublish() {
startBackground && publish
}
case $1 in
start) start ;;
stop) stop ;;
publish) publish ;;
startBackgroundAndPublish) startBackgroundAndPublish ;;
createVerdaccioNPMUser) createVerdaccioNPMUser ;;
loginNPMUser) loginNPMUser ;;
lernaUpdatePackageVersions) lernaUpdatePackageVersions ;;
lernaBuildAndCommit) lernaBuildAndCommit ;;
lernaPublish) lernaPublish ;;
*) helpFunction ;; # Print helpFunction in case parameter is non-existent
esac