@decaf-ts/utils 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/build-scripts.cjs +9967 -0
- package/bin/tag-release.cjs +9693 -0
- package/bin/tag-release.sh +82 -0
- package/bin/update-scripts.cjs +10117 -0
- package/dist/utils.cjs +3 -3
- package/dist/utils.esm.cjs +3 -3
- package/lib/bin/tag-release.cjs +0 -0
- package/lib/bin/update-scripts.cjs +0 -0
- package/lib/cli/commands/build-scripts.cjs +1 -1
- package/lib/esm/cli/commands/build-scripts.js +1 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +2 -2
- package/lib/index.cjs +2 -2
- package/lib/index.d.ts +2 -2
- package/package.json +20 -16
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/bin/bash -e
|
|
2
|
+
|
|
3
|
+
function ask_yes_or_no(){
|
|
4
|
+
# Test if there are enough arguments
|
|
5
|
+
if [[ $# -gt 2 ]]; then
|
|
6
|
+
exit 1
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
local message="${1}"
|
|
10
|
+
local y="y"
|
|
11
|
+
local n="N"
|
|
12
|
+
|
|
13
|
+
# defaults to no if not otherwise specified
|
|
14
|
+
[[ $2 == "yes" ]] && local default="yes" && y="Y" && n="n" || local default="no"
|
|
15
|
+
|
|
16
|
+
read -p "$message ([$y]es or [$n]o): "
|
|
17
|
+
case $(echo $REPLY | tr '[A-Z]' '[a-z]') in
|
|
18
|
+
y|yes) local response="yes" ;;
|
|
19
|
+
*) local response="no" ;;
|
|
20
|
+
esac
|
|
21
|
+
if [[ $response == "$default" ]] || [[ -z $REPLY ]]; then
|
|
22
|
+
echo $default
|
|
23
|
+
else
|
|
24
|
+
echo $response
|
|
25
|
+
fi
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function ask(){
|
|
29
|
+
# Test if there are enough arguments
|
|
30
|
+
if [[ $# -ne 1 ]]; then
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
local answer
|
|
35
|
+
local real_answer=""
|
|
36
|
+
|
|
37
|
+
while [[ "" == "$real_answer" ]]; do
|
|
38
|
+
read -p "Please type in $1: " answer
|
|
39
|
+
[[ "yes" == $(ask_yes_or_no "Is $answer you final answer?") ]] \
|
|
40
|
+
&& real_answer="$answer"
|
|
41
|
+
done
|
|
42
|
+
|
|
43
|
+
echo "$real_answer"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if [[ $# -ne 0 ]];then
|
|
47
|
+
TAG="$1"
|
|
48
|
+
if [[ -n "$TAG" ]];then
|
|
49
|
+
shift
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
MESSAGE="$*"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo "Preparing Release... "
|
|
56
|
+
npm run prepare-release
|
|
57
|
+
|
|
58
|
+
if [[ -z "$TAG" ]];then
|
|
59
|
+
echo "Listing existing tags..."
|
|
60
|
+
git tag --sort=-taggerdate | head -n 5
|
|
61
|
+
while [[ "$TAG" == "" || ! "${TAG}" =~ ^v[0-9]+\.[0-9]+.[0-9]+(\-[0-9a-zA-Z\-]+)?$ ]]; do
|
|
62
|
+
TAG=$(ask "What should be the new tag? (accepts v*.*.*[-...])")
|
|
63
|
+
done
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
if [[ -z "$MESSAGE" ]];then
|
|
67
|
+
MESSAGE=$(ask "Tag Message")
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
if [[ $(git status --porcelain) ]]; then
|
|
71
|
+
git add .
|
|
72
|
+
git commit -m "$TAG - $MESSAGE - after release preparation"
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
npm version "$TAG" -m "$MESSAGE"
|
|
76
|
+
|
|
77
|
+
git push --follow-tags
|
|
78
|
+
|
|
79
|
+
if [[ "$MESSAGE" =~ -no-ci$ ]]; then
|
|
80
|
+
NPM_TOKEN=$(cat .npmtoken) npm publish --access public
|
|
81
|
+
fi
|
|
82
|
+
|