-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli
executable file
·663 lines (572 loc) · 30 KB
/
cli
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
#!/usr/bin/env bash
# shellcheck disable=SC1090,SC2034
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# ,ad8888ba, 88 88
# d8"' `"8b 88 88
# d8' 88 88
# 88 88 88
# 88 88 88
# Y8, 88 88
# Y8a. .a8P 88 88
# `"Y8888Y"' 88888888888 88
#
# ==================================================================================================
# Command-line interface for @seantrane/dotfiles
#
# See README file for more information.
# ==================================================================================================
set -o errexit # exit if a command fails
set -o pipefail # return exit status of last command
[[ ! -z "${NOUNSET:-}" ]] && set -o nounset # exit if using undeclared variable
[[ ! -z "${TRACE:-}" ]] && set -o xtrace # trace of command execution
IFS=$'\n\t' # (Internal Field Separator) better word splitting
__DIR=$( cd "${BASH_SOURCE%/*}" && pwd ) # path to script directory
__FILE="${__DIR}/$(basename "${BASH_SOURCE[0]}")" # path to script file
__BASE="$(basename "$__FILE" .sh)" # filename of script
__DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # timestamp
# --------------------------------------------------------------------------------------------------
# CHECK/LOAD/SET SCRIPT REQUIREMENTS
# --------------------------------------------------------------------------------------------------
# if ! type "npm" &> /dev/null; then
# echo "!!! npm is required to run this script !!!" && echo ""
# echo "!!! Please install npm before running this script !!!" && echo ""
# exit 1
# fi
# Shell Support
. "${__DIR}/functions/docker_clean"
. "${__DIR}/functions/run_or_fail"
. "${__DIR}/functions/sh_alert"
. "${__DIR}/functions/sh_code"
. "${__DIR}/functions/sh_error"
. "${__DIR}/functions/sh_fail"
. "${__DIR}/functions/sh_heading"
. "${__DIR}/functions/sh_info"
. "${__DIR}/functions/sh_msg"
. "${__DIR}/functions/sh_note"
. "${__DIR}/functions/sh_success"
. "${__DIR}/functions/sh_user"
# Start script timer
start=$(date +%s)
echo "CLI script started (${__DATE})"
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# 88888888888 888b 88 8b d8
# 88 8888b 88 `8b d8'
# 88 88 `8b 88 `8b d8'
# 88aaaaa 88 `8b 88 `8b d8'
# 88""""" 88 `8b 88 `8b d8'
# 88 88 `8b 88 `8b d8'
# 88 88 `8888 `888'
# 88888888888 88 `888 `8'
#
# --------------------------------------------------------------------------------------------------
# TOGGLES / SPECIAL VARIABLES GO HERE:
# --------------------------------------------------------------------------------------------------
TEMP_PATH="${__DIR}/temp"
TEMP_BUILD_PATH="${TEMP_PATH}/build"
# Get environment variables from `.env` file, if available.
DOTENV_PATH="${__DIR}/.env"
[[ -e "$DOTENV_PATH" ]] && {
echo "Loading \`.env\` variables"
DOTENV_SHELL_LOADER_SAVED_OPTS=$(set +o)
set -o allexport
# shellcheck disable=SC1090,SC1091
[[ -f "$DOTENV_PATH" ]] && . "$DOTENV_PATH"
set +o allexport
eval "$DOTENV_SHELL_LOADER_SAVED_OPTS"
unset DOTENV_SHELL_LOADER_SAVED_OPTS
}
# Get private variables/credentials from `.localrc` file, if available.
DOTLOCALRC_PATH="${__DIR}/.localrc"
[[ -e "$DOTLOCALRC_PATH" ]] && {
echo "Loading \`.localrc\` variables"
DOTENV_SHELL_LOADER_SAVED_OPTS=$(set +o)
set -o allexport
# shellcheck disable=SC1090,SC1091
[[ -f "$DOTLOCALRC_PATH" ]] && . "$DOTLOCALRC_PATH"
set +o allexport
eval "$DOTENV_SHELL_LOADER_SAVED_OPTS"
unset DOTENV_SHELL_LOADER_SAVED_OPTS
}
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# 88 88 88888888888 88 88888888ba
# 88 88 88 88 88 "8b
# 88 88 88 88 88 ,8P
# 88aaaaaaaa88 88aaaaa 88 88aaaaaa8P'
# 88""""""""88 88""""" 88 88""""""'
# 88 88 88 88 88
# 88 88 88 88 88
# 88 88 88888888888 88888888888 88
#
# --------------------------------------------------------------------------------------------------
# HELP DOCS GO HERE:
# --------------------------------------------------------------------------------------------------
CLI_HELP_DOC="
CLI
Usage:
./cli [--option]
bash ./cli [--option]
./cli -h | --help
# Debug the script
./cli --debug --clean
Options:
--debug Turn on debug mode
--clean Clean existing application build/test files
-lint Run linters
-t, --test Run unit/integration/mock tests
--report Run scanner/reporting
-s, --start Start the application
-s, --stop Stop the application
-p, --publish Publish the application
-h, --help CLI HELP
"
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# db 88888888ba ,ad8888ba, ad88888ba
# d88b 88 "8b d8"' `"8b d8" "8b
# d8'`8b 88 ,8P d8' Y8,
# d8' `8b 88aaaaaa8P' 88 `Y8aaaaa,
# d8YaaaaY8b 88""""88' 88 88888 `"""""8b,
# d8""""""""8b 88 `8b Y8, 88 `8b
# d8' `8b 88 `8b Y8a. .a88 Y8a a8P
# d8' `8b 88 `8b `"Y88888P" "Y88888P"
#
# --------------------------------------------------------------------------------------------------
echo "Loading arguments"
# --------------------------------------------------------------------------------------------------
# Arguments are sorted in the order they are played in the script
# --------------------------------------------------------------------------------------------------
RUN_DEBUG=false
RUN_CLEAN=false
RUN_LINT=false
RUN_TEST=false
RUN_REPORT=false
RUN_START=false
RUN_STOP=false
RUN_PUBLISH=false
for ARG in "$@"; do
case "$ARG" in
--help)
echo "${CLI_HELP_DOC}"
exit
;;
-h)
echo "${CLI_HELP_DOC}"
exit
;;
--debug)
RUN_DEBUG=true
;;
--clean)
RUN_CLEAN=true
;;
--lint)
RUN_LINT=true
;;
--test)
RUN_TEST=true
;;
-t)
RUN_TEST=true
;;
--report)
RUN_REPORT=true
;;
--start)
RUN_START=true
;;
-s)
RUN_START=true
;;
--stop)
RUN_STOP=true
;;
--publish)
RUN_PUBLISH=true
;;
-p)
RUN_PUBLISH=true
;;
# ==============================================================================================
# ADDITIONAL ARGUMENTS GO HERE
# ==============================================================================================
--egg)
echo "The egg hatched."
echo "${__DATE}"
;;
# ----------------------------------------------------------------------------------------------
# LEGEND:
# ----------------------------------------------------------------------------------------------
# Flag-based:
# --flag)
# FLAG=true
# ;;
# -f)
# FLAG_SHORTHAND=true
# ;;
# ----------------------------------------------------------------------------------------------
# String-based:
# --str=*)
# STR=${ARG#--str=}
# ;;
# ----------------------------------------------------------------------------------------------
# CSV-based:
# --csv=*)
# CSV_STR=${ARG#--csv=}
# CSV=( ${CSV_STR//,/ } )
# ;;
# ----------------------------------------------------------------------------------------------
# ==============================================================================================
# Catch-all failure for unknown arguments
# ==============================================================================================
*)
echo "Unknown option $ARG."
exit 1
;;
esac
done
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# 8b d8 db 88888888ba ad88888ba
# `8b d8' d88b 88 "8b d8" "8b
# `8b d8' d8'`8b 88 ,8P Y8,
# `8b d8' d8' `8b 88aaaaaa8P' `Y8aaaaa,
# `8b d8' d8YaaaaY8b 88""""88' `"""""8b,
# `8b d8' d8""""""""8b 88 `8b `8b
# `888' d8' `8b 88 `8b Y8a a8P
# `8' d8' `8b 88 `8b "Y88888P"
#
# --------------------------------------------------------------------------------------------------
echo "Loading/setting application variables"
# --------------------------------------------------------------------------------------------------
# SHARED VARIABLES GO HERE:
# --------------------------------------------------------------------------------------------------
[[ -z "${ENV}" ]] && ENV="local"
# fail on empty/missing vars
# [[ -z "${VAR_X:-}" ]] && { echo "Missing VAR_X" && exit 1 }
# default values for empty/missing vars
# [[ -z "${VAR_X}" ]] && VAR_X="default"
# null default if var not available
# VAR_Z="${VAR_Y:-}"
# "default" if var not available
# VAR_Z="${VAR_Y:"default"}"
# group all of the variables in an array.
declare -a ENV_VARS=(
"__DATE"
"ENV"
)
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# ,ad8888ba, 88 88888888888 db 888b 88
# d8"' `"8b 88 88 d88b 8888b 88
# d8' 88 88 d8'`8b 88 `8b 88
# 88 88 88aaaaa d8' `8b 88 `8b 88
# 88 88 88""""" d8YaaaaY8b 88 `8b 88
# Y8, 88 88 d8""""""""8b 88 `8b 88
# Y8a. .a8P 88 88 d8' `8b 88 `8888
# `"Y8888Y"' 88888888888 88888888888 d8' `8b 88 `888
#
# --------------------------------------------------------------------------------------------------
if ( $RUN_CLEAN ) && ( $RUN_DEBUG ); then echo "DEBUG MODE: CLEAN scripting bypassed"
elif ( $RUN_CLEAN ); then echo "CLEAN script started"
# --------------------------------------------------------------------------------------------------
# SCRIPTING GOES HERE:
# --------------------------------------------------------------------------------------------------
echo "Removing all auto-generated directories"
(
rm -rf \
coverage \
doc \
node_modules \
"$TEMP_BUILD_PATH"
) < /dev/null 2> /dev/null
# --------------------------------------------------------------------------------------------------
echo "CLEAN script completed successfully"; fi
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# 88 88 888b 88 888888888888
# 88 88 8888b 88 88
# 88 88 88 `8b 88 88
# 88 88 88 `8b 88 88
# 88 88 88 `8b 88 88
# 88 88 88 `8b 88 88
# 88 88 88 `8888 88
# 88888888888 88 88 `888 88
#
# ==================================================================================================
if ( $RUN_LINT ) && ( $RUN_DEBUG ); then sh_alert "DEBUG MODE: Application linter bypassed"
elif ( $RUN_LINT ); then sh_heading "LINT script started"
# --------------------------------------------------------------------------------------------------
# SCRIPTING GOES HERE:
# --------------------------------------------------------------------------------------------------
sh_info "Running markdownlint"
run_or_fail npm run lint
sh_info "Running linter on shell scripts"
docker pull koalaman/shellcheck:stable
docker run -v "$PWD:/mnt" koalaman/shellcheck \
./cli \
./script/* \
./**/*.bash \
./**/*.sh \
./**/*.zsh \
|| sh_fail "ShellCheck failed!"
docker_clean koalaman/shellcheck koalaman/shellcheck:stable
# --------------------------------------------------------------------------------------------------
sh_success "LINT script completed successfully"; fi
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# 888888888888 88888888888 ad88888ba 888888888888
# 88 88 d8" "8b 88
# 88 88 Y8, 88
# 88 88aaaaa `Y8aaaaa, 88
# 88 88""""" `"""""8b, 88
# 88 88 `8b 88
# 88 88 Y8a a8P 88
# 88 88888888888 "Y88888P" 88
#
# ==================================================================================================
if ( $RUN_TEST ) && ( $RUN_DEBUG ); then sh_alert "DEBUG MODE: Unit/Integration/Mock Tests bypassed"
elif ( $RUN_TEST ); then sh_heading "TEST script started"
# --------------------------------------------------------------------------------------------------
# SCRIPTING GOES HERE:
# --------------------------------------------------------------------------------------------------
sh_info "Running Unit/Integration/Mock Tests"
TESTS_IMAGE="${APP_NAME}-test"
TESTS_CONTAINER="${TESTS_IMAGE}-container"
docker_clean "${TESTS_CONTAINER}" "${TESTS_IMAGE}:${APP_TAG}"
# Create
docker build -f Dockerfile.test -t "${TESTS_IMAGE}:${APP_TAG}" . && docker images
# docker run -it -v ${PWD}:/usr/src/app --name ${TESTS_CONTAINER} --rm ${TESTS_IMAGE}:${APP_TAG}; echo $?
docker run --name "${TESTS_CONTAINER}" -d -P "${TESTS_IMAGE}:${APP_TAG}" \
|| {
docker_clean "${TESTS_CONTAINER}" "${TESTS_IMAGE}:${APP_TAG}"
sh_fail "Test(s) failed!"
}
echo "CONTAINER_NAME: ${TESTS_CONTAINER}"
CONTAINER_ID=$(docker ps -aqf "name=${TESTS_CONTAINER}")
echo "CONTAINER_ID: ${CONTAINER_ID}"
echo "Ready to run; docker cp ${CONTAINER_ID}:/usr/src/app/coverage.tgz ."
docker cp "${CONTAINER_ID}:/usr/src/app/coverage.tgz" .
rm -rf coverage
tar -xzvf coverage.tgz coverage/
docker_clean "${TESTS_CONTAINER}" "${TESTS_IMAGE}:${APP_TAG}"
# --------------------------------------------------------------------------------------------------
sh_success "TEST script completed successfully"; fi
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# 88888888ba 88888888888 88888888ba ,ad8888ba, 88888888ba 888888888888
# 88 "8b 88 88 "8b d8"' `"8b 88 "8b 88
# 88 ,8P 88 88 ,8P d8' `8b 88 ,8P 88
# 88aaaaaa8P' 88aaaaa 88aaaaaa8P' 88 88 88aaaaaa8P' 88
# 88""""88' 88""""" 88""""""' 88 88 88""""88' 88
# 88 `8b 88 88 Y8, ,8P 88 `8b 88
# 88 `8b 88 88 Y8a. .a8P 88 `8b 88
# 88 `8b 88888888888 88 `"Y8888Y"' 88 `8b 88
#
# ==================================================================================================
if ( $RUN_REPORT ) && ( $RUN_DEBUG ); then sh_alert "DEBUG MODE: REPORT scripting bypassed"
elif ( $RUN_REPORT ); then sh_heading "REPORT script started"
# --------------------------------------------------------------------------------------------------
# SCRIPTING GOES HERE:
# --------------------------------------------------------------------------------------------------
if [[ -z "${CODECOV_TOKEN:-}" ]]; then
sh_alert "'CODECOV_TOKEN' variable was not found or was empty."
sh_text "codecov.io reporting cannot be performed without 'CODECOV_TOKEN' variable set."
else
sh_heading "codecov.io script started"
[[ ! -d "${__DIR}/coverage" ]] && sh_fail "'./coverage' not found."
bash <(curl -s https://codecov.io/bash)
fi
if [[ -e "${__DIR}/sonar-project.properties" ]]; then
if [[ -z "${SONAR_SCANNER_PATH:-}" ]]; then
sh_alert "'SONAR_SCANNER_PATH' variable was not found or was empty."
sh_text "SONAR reporting cannot be performed without 'SONAR_SCANNER_PATH' variable set."
elif [[ -z "${SONAR_SERVER_URL:-}" ]]; then
sh_alert "'SONAR_SERVER_URL' variable was not found or was empty."
sh_text "SONAR reporting cannot be performed without 'SONAR_SERVER_URL' variable set."
else
sh_heading "SONAR script started"
require_bin "${SONAR_SCANNER_PATH}"
[[ ! -d "${__DIR}/coverage" ]] && sh_fail "'./coverage' not found."
run_or_fail "$SONAR_SCANNER_PATH" -Dsonar.host.url="$SONAR_SERVER_URL"
fi
fi
# --------------------------------------------------------------------------------------------------
sh_success "REPORT script completed successfully"; fi
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# ad88888ba 888888888888 db 88888888ba 888888888888
# d8" "8b 88 d88b 88 "8b 88
# Y8, 88 d8'`8b 88 ,8P 88
# `Y8aaaaa, 88 d8' `8b 88aaaaaa8P' 88
# `"""""8b, 88 d8YaaaaY8b 88""""88' 88
# `8b 88 d8""""""""8b 88 `8b 88
# Y8a a8P 88 d8' `8b 88 `8b 88
# "Y88888P" 88 d8' `8b 88 `8b 88
#
# ==================================================================================================
if ( $RUN_START ) &&( $RUN_DEBUG ); then echo "DEBUG MODE: START scripting bypassed"
elif ( $RUN_START ); then echo "START script started"
# --------------------------------------------------------------------------------------------------
# SCRIPTING GOES HERE:
# --------------------------------------------------------------------------------------------------
# ...
# --------------------------------------------------------------------------------------------------
echo "START script completed successfully"; fi
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# ad88888ba 888888888888 ,ad8888ba, 88888888ba
# d8" "8b 88 d8"' `"8b 88 "8b
# Y8, 88 d8' `8b 88 ,8P
# `Y8aaaaa, 88 88 88 88aaaaaa8P'
# `"""""8b, 88 88 88 88""""""'
# `8b 88 Y8, ,8P 88
# Y8a a8P 88 Y8a. .a8P 88
# "Y88888P" 88 `"Y8888Y"' 88
#
# ==================================================================================================
if ( $RUN_STOP ) && ( $RUN_DEBUG ); then echo "DEBUG MODE: STOP scripting bypassed"
elif ( $RUN_STOP ); then echo "STOP script started"
# --------------------------------------------------------------------------------------------------
# SCRIPTING GOES HERE:
# --------------------------------------------------------------------------------------------------
# ...
# --------------------------------------------------------------------------------------------------
echo "STOP script completed successfully"; fi
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# 88888888ba 88 88 88888888ba 88 88 ad88888ba 88 88
# 88 "8b 88 88 88 "8b 88 88 d8" "8b 88 88
# 88 ,8P 88 88 88 ,8P 88 88 Y8, 88 88
# 88aaaaaa8P' 88 88 88aaaaaa8P' 88 88 `Y8aaaaa, 88aaaaaaaa88
# 88""""""' 88 88 88""""""8b, 88 88 `"""""8b, 88""""""""88
# 88 88 88 88 `8b 88 88 `8b 88 88
# 88 Y8a. .a8P 88 a8P 88 88 Y8a a8P 88 88
# 88 `"Y8888Y"' 88888888P" 88888888888 88 "Y88888P" 88 88
#
# ==================================================================================================
if ( $RUN_PUBLISH ) && ( $RUN_DEBUG ); then sh_alert "DEBUG MODE: PUBLISH scripting bypassed"
elif ( $RUN_PUBLISH ); then sh_heading "PUBLISH script started"
# --------------------------------------------------------------------------------------------------
# SCRIPTING GOES HERE:
# --------------------------------------------------------------------------------------------------
run_or_fail npm run semantic-release
# --------------------------------------------------------------------------------------------------
sh_success "PUBLISH script completed successfully"; fi
# **************************************************************************************************
# ==================================================================================================
# ==================================================================================================
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# ==================================================================================================
# ==================================================================================================
# **************************************************************************************************
#
# 888888888888 88 88 88888888888 88888888888 888b 88 88888888ba,
# 88 88 88 88 88 8888b 88 88 `"8b
# 88 88 88 88 88 88 `8b 88 88 `8b
# 88 88aaaaaaaa88 88aaaaa 88aaaaa 88 `8b 88 88 88
# 88 88""""""""88 88""""" 88""""" 88 `8b 88 88 88
# 88 88 88 88 88 88 `8b 88 88 8P
# 88 88 88 88 88 88 `8888 88 .a8P
# 88 88 88 88888888888 88888888888 88 `888 88888888Y"'
#
# ==================================================================================================
declare -a END_VARS=(
"__DIR"
"__FILE"
"__BASE"
"${ENV_VARS[@]}"
)
echo "{"
for var in "${END_VARS[@]}"; do
echo " \"${var}\": \"${!var}\""
done
echo "}"
echo "CLI script completed successfully"
end=$(date +%s)
runlen=$(echo "$end - $start" | bc)
if type "python" &> /dev/null; then
runtime=$(python -c "print '%u:%02u' % ($runlen/60, $runlen%60)")
else
runtime="$runlen seconds"
fi
echo "runtime: ${runtime}"