@decaf-ts/utils 0.9.3 → 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.
@@ -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 [[ "$(cat .token)" ]]; then
82
- git push -u "https://${GIT_USER}:$(cat .token)@${REMOTE_URL#https://}" --follow-tags
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
- NPM_TOKEN=$(cat .npmtoken) npm publish --access public
139
+ # Use .npmtoken for publishing; respect chosen access level
140
+ NPM_TOKEN=$(cat .npmtoken) npm publish --access "$NPM_ACCESS_VALUE"
89
141
  fi
@@ -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.2";
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.2";
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.2";
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.2";
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decaf-ts/utils",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "module management utils for decaf-ts",
5
5
  "type": "module",
6
6
  "exports": {
@@ -87,8 +87,14 @@
87
87
  "url": "https://github.com/decaf-ts/utils/issues"
88
88
  },
89
89
  "homepage": "https://github.com/decaf-ts/utils#readme",
90
- "devDependencies": {
90
+ "dependencies": {
91
+ "@decaf-ts/logging": "latest",
91
92
  "@eslint/js": "^9.25.1",
93
+ "@rollup/plugin-commonjs": "^28.0.9",
94
+ "@rollup/plugin-json": "^6.1.0",
95
+ "@rollup/plugin-node-resolve": "^16.0.3",
96
+ "@rollup/plugin-terser": "^0.4.4",
97
+ "@rollup/plugin-typescript": "^12.3.0",
92
98
  "@stylistic/eslint-plugin": "^4.2.0",
93
99
  "@types/jest": "^29.5.14",
94
100
  "@types/prompts": "^2.4.9",
@@ -108,24 +114,16 @@
108
114
  "nodemon": "^3.1.9",
109
115
  "npm-check-updates": "^18.0.0",
110
116
  "prettier": "3.5.3",
117
+ "prompts": "^2.4.2",
111
118
  "rimraf": "^6.0.1",
119
+ "rollup": "^2.79.2",
120
+ "styled-string-builder": "latest",
112
121
  "ts-jest": "^29.3.2",
113
122
  "ts-loader": "^9.5.2",
114
123
  "ts-node": "^10.9.2",
115
124
  "tsx": "^4.20.6",
125
+ "typed-object-accumulator": "latest",
116
126
  "typescript": "^5.8.3",
117
127
  "typescript-eslint": "^8.31.0"
118
- },
119
- "dependencies": {
120
- "@decaf-ts/logging": "latest",
121
- "@rollup/plugin-commonjs": "^28.0.9",
122
- "@rollup/plugin-json": "^6.1.0",
123
- "@rollup/plugin-node-resolve": "^16.0.3",
124
- "@rollup/plugin-terser": "^0.4.4",
125
- "@rollup/plugin-typescript": "^12.3.0",
126
- "prompts": "^2.4.2",
127
- "rollup": "^2.79.2",
128
- "styled-string-builder": "latest",
129
- "typed-object-accumulator": "latest"
130
128
  }
131
129
  }