@eggplanty/mycli 0.1.3 → 0.1.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/README.md ADDED
@@ -0,0 +1 @@
1
+ # test_npm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggplanty/mycli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "A simple CLI demo built with Go",
5
5
  "bin": {
6
6
  "mycli": "scripts/run.js"
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
6
+
7
+ # Read version from package.json
8
+ VERSION=$(node -p "require('${REPO_ROOT}/package.json').version")
9
+
10
+ if [ -z "$VERSION" ]; then
11
+ echo "Error: could not read version from package.json" >&2
12
+ exit 1
13
+ fi
14
+
15
+ TAG="v${VERSION}"
16
+
17
+ echo "Version: ${VERSION}"
18
+ echo "Tag: ${TAG}"
19
+
20
+ # Check if tag already exists locally
21
+ if git rev-parse "$TAG" >/dev/null 2>&1; then
22
+ echo "Tag ${TAG} already exists locally, skipping."
23
+ exit 0
24
+ fi
25
+
26
+ # Check if tag already exists on remote
27
+ if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then
28
+ echo "Tag ${TAG} already exists on remote, skipping."
29
+ exit 0
30
+ fi
31
+
32
+ # Create and push tag
33
+ git tag "$TAG"
34
+ git push origin "$TAG"
35
+
36
+ echo "Successfully created and pushed tag ${TAG}"