-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.sh
executable file
·71 lines (56 loc) · 1.47 KB
/
cli.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
#!/usr/bin/env bash
set -euo pipefail
shopt -s globstar
ENTRY_FILE="./src/cli.ts"
MOD_FILE="./src/mod.ts"
update_deps() {
deno run -A jsr:@wok/deup@1.3.1 update "$@"
"$0" update_lock
}
update_lock() {
rm -f deno.lock
deno cache --reload --lock=deno.lock --frozen=false "${ENTRY_FILE}" "${MOD_FILE}"
}
check_all() {
deno check ./**/*.ts
}
code_quality() {
echo "Checking formatting..."
deno fmt --check ./src
echo "Checking types..."
"$0" check_all
echo "Linting..."
deno lint ./src
echo "Running eslint..."
eslint .
}
auto_fmt() {
deno fmt ./src
}
set_version() {
local VERSION=${1:-"dev"}
local JSR_JSON
JSR_JSON=$(jq -e --arg VERSION "${VERSION}" '.version=$VERSION' ./deno.json)
echo "${JSR_JSON}" >./deno.json
}
jsr_publish() {
deno publish --config ./deno.json --allow-slow-types --allow-dirty
}
create_release() {
local RELEASE_VERSION=${1:?"Release version is required"}
local RELEASE_BRANCH="releases/${RELEASE_VERSION}"
git config --global user.email "ci-runner@shopstic.com"
git config --global user.name "CI Runner"
git checkout -b "${RELEASE_BRANCH}"
git add ./deno.json
git commit -m "Release ${RELEASE_VERSION}"
git push origin "${RELEASE_BRANCH}"
gh release create "${RELEASE_VERSION}" --title "Release ${RELEASE_VERSION}" --notes "" --target "${RELEASE_BRANCH}"
}
update_cache() {
deno cache "${ENTRY_FILE}" "${MOD_FILE}"
}
run() {
deno run --lock ./deno.lock --cached-only -A --check "${ENTRY_FILE}" "$@"
}
"$@"