@decaf-ts/utils 0.9.4 → 0.9.5
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/tag-release.sh +55 -3
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/package.json +1 -1
package/bin/tag-release.sh
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
#!/bin/bash -e
|
|
2
2
|
|
|
3
|
+
current_branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)
|
|
4
|
+
if [[ "$current_branch" != "master" && "$current_branch" != "main" ]]; then
|
|
5
|
+
echo "Error: release must be run from 'master' or 'main' branch. Current branch: $current_branch" >&2
|
|
6
|
+
exit 1
|
|
7
|
+
fi
|
|
8
|
+
|
|
3
9
|
function ask_yes_or_no(){
|
|
4
10
|
# Test if there are enough arguments
|
|
5
11
|
if [[ $# -gt 2 ]]; then
|
|
@@ -43,6 +49,35 @@ function ask(){
|
|
|
43
49
|
echo "$real_answer"
|
|
44
50
|
}
|
|
45
51
|
|
|
52
|
+
# Default publish preference is public
|
|
53
|
+
PUBLISH_ACCESS_FLAG="public"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
while [[ $# -gt 0 ]]; do
|
|
57
|
+
case "$1" in
|
|
58
|
+
--public)
|
|
59
|
+
PUBLISH_ACCESS_FLAG="public"
|
|
60
|
+
shift
|
|
61
|
+
;;
|
|
62
|
+
--private)
|
|
63
|
+
PUBLISH_ACCESS_FLAG="private"
|
|
64
|
+
shift
|
|
65
|
+
;;
|
|
66
|
+
--)
|
|
67
|
+
shift
|
|
68
|
+
break
|
|
69
|
+
;;
|
|
70
|
+
-* )
|
|
71
|
+
# Unknown flag: stop flag parsing so older behavior (treat as TAG) remains
|
|
72
|
+
break
|
|
73
|
+
;;
|
|
74
|
+
*)
|
|
75
|
+
# first non-flag — stop parsing
|
|
76
|
+
break
|
|
77
|
+
;;
|
|
78
|
+
esac
|
|
79
|
+
done
|
|
80
|
+
|
|
46
81
|
if [[ $# -ne 0 ]];then
|
|
47
82
|
TAG="$1"
|
|
48
83
|
if [[ -n "$TAG" ]];then
|
|
@@ -78,12 +113,29 @@ GIT_USER=$(git config user.name)
|
|
|
78
113
|
|
|
79
114
|
REMOTE_URL=$(git remote get-url origin)
|
|
80
115
|
|
|
81
|
-
if [[
|
|
82
|
-
|
|
116
|
+
if [[ -s .token ]]; then
|
|
117
|
+
# Save current branch and upstream before pushing
|
|
118
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
119
|
+
UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null || true)
|
|
120
|
+
|
|
121
|
+
# Push using token; omit -u to avoid changing upstream
|
|
122
|
+
git push "https://${GIT_USER}:$(cat .token)@${REMOTE_URL#https://}" --follow-tags
|
|
123
|
+
# Restore upstream tracking if it existed
|
|
124
|
+
if [[ -n "$UPSTREAM" ]]; then
|
|
125
|
+
git branch --set-upstream-to="$UPSTREAM" "$CURRENT_BRANCH" 2>/dev/null || true
|
|
126
|
+
fi
|
|
83
127
|
else
|
|
84
128
|
git push --follow-tags
|
|
85
129
|
fi
|
|
86
130
|
|
|
131
|
+
# Map user-friendly flag to npm --access value. npm expects "public" or "restricted"
|
|
132
|
+
if [[ "$PUBLISH_ACCESS_FLAG" == "public" ]]; then
|
|
133
|
+
NPM_ACCESS_VALUE="public"
|
|
134
|
+
else
|
|
135
|
+
NPM_ACCESS_VALUE="restricted"
|
|
136
|
+
fi
|
|
137
|
+
|
|
87
138
|
if [[ "$MESSAGE" =~ -no-ci$ ]]; then
|
|
88
|
-
|
|
139
|
+
# Use .npmtoken for publishing; respect chosen access level
|
|
140
|
+
NPM_TOKEN=$(cat .npmtoken) npm publish --access "$NPM_ACCESS_VALUE"
|
|
89
141
|
fi
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export * from "./writers";
|
|
|
26
26
|
* @const VERSION
|
|
27
27
|
* @memberOf module:utils
|
|
28
28
|
*/
|
|
29
|
-
export declare const VERSION = "0.9.
|
|
29
|
+
export declare const VERSION = "0.9.4";
|
|
30
30
|
/**
|
|
31
31
|
* @description Represents the current version of the module.
|
|
32
32
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|
package/lib/esm/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export * from "./writers/index.js";
|
|
|
26
26
|
* @const VERSION
|
|
27
27
|
* @memberOf module:utils
|
|
28
28
|
*/
|
|
29
|
-
export const VERSION = "0.9.
|
|
29
|
+
export const VERSION = "0.9.4";
|
|
30
30
|
/**
|
|
31
31
|
* @description Represents the current version of the module.
|
|
32
32
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|
package/lib/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ __exportStar(require("./writers/index.cjs"), exports);
|
|
|
43
43
|
* @const VERSION
|
|
44
44
|
* @memberOf module:utils
|
|
45
45
|
*/
|
|
46
|
-
exports.VERSION = "0.9.
|
|
46
|
+
exports.VERSION = "0.9.4";
|
|
47
47
|
/**
|
|
48
48
|
* @description Represents the current version of the module.
|
|
49
49
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|
package/lib/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export * from "./writers";
|
|
|
26
26
|
* @const VERSION
|
|
27
27
|
* @memberOf module:utils
|
|
28
28
|
*/
|
|
29
|
-
export declare const VERSION = "0.9.
|
|
29
|
+
export declare const VERSION = "0.9.4";
|
|
30
30
|
/**
|
|
31
31
|
* @description Represents the current version of the module.
|
|
32
32
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|