@abyrd9/harbor-cli 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/package.json +6 -4
  2. package/scripts/dev.sh +18 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyrd9/harbor-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A CLI tool for managing local development services with automatic subdomain routing",
5
5
  "type": "module",
6
6
  "bin": {
@@ -50,19 +50,21 @@
50
50
  "main": "index.js",
51
51
  "harbor": {
52
52
  "domain": "localhost",
53
- "useSudo": false,
53
+ "useSudo": true,
54
54
  "services": [
55
55
  {
56
56
  "name": "vite-project",
57
57
  "path": "test-services/vite-project",
58
58
  "subdomain": "vite-project",
59
- "command": "npm run dev"
59
+ "command": "npm run dev",
60
+ "port": 5173
60
61
  },
61
62
  {
62
63
  "name": "go-api",
63
64
  "path": "test-services/go-api",
64
65
  "subdomain": "go-api",
65
- "command": "go run ."
66
+ "command": "go run .",
67
+ "port": 8080
66
68
  }
67
69
  ]
68
70
  }
package/scripts/dev.sh CHANGED
@@ -81,14 +81,12 @@ tmux rename-window -t local-dev-test:0 'Terminal'
81
81
 
82
82
  # Check if any services need Caddy
83
83
  needs_caddy=false
84
- get_harbor_config | jq -c '.services[]' | while read service; do
85
- subdomain=$(echo $service | jq -r '.subdomain // empty')
86
- port=$(echo $service | jq -r '.port // empty')
87
- if [ ! -z "$subdomain" ] && [ ! -z "$port" ]; then
88
- needs_caddy=true
89
- break
90
- fi
91
- done
84
+ echo "Checking for services that need Caddy..."
85
+ if get_harbor_config | jq -e '.services[] | select(.subdomain != null and .port != null) | true' > /dev/null; then
86
+ needs_caddy=true
87
+ echo "Found services that need Caddy"
88
+ fi
89
+ echo "needs_caddy value: $needs_caddy"
92
90
 
93
91
  window_index=1 # Start from index 1
94
92
 
@@ -96,7 +94,18 @@ window_index=1 # Start from index 1
96
94
  if [ "$needs_caddy" = true ]; then
97
95
  echo "Creating window for Caddy"
98
96
  tmux new-window -t local-dev-test:1 -n 'Caddy'
99
- tmux send-keys -t local-dev-test:1 'caddy run' C-m
97
+
98
+ # Check if useSudo is true in harbor config
99
+ use_sudo=$(get_harbor_config | jq -r '.useSudo // false')
100
+ echo "useSudo value: $use_sudo"
101
+ if [ "$use_sudo" = "true" ]; then
102
+ echo "Running Caddy with sudo"
103
+ tmux send-keys -t local-dev-test:1 'sudo caddy run' C-m
104
+ else
105
+ echo "Running Caddy without sudo"
106
+ tmux send-keys -t local-dev-test:1 'caddy run' C-m
107
+ fi
108
+
100
109
  window_index=2 # Start services from index 2
101
110
  fi
102
111