futrou 2.0.8 → 2.0.10

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/install.ps1 CHANGED
@@ -111,7 +111,11 @@ if (-not $downloaded) {
111
111
  Invoke-RestMethod -Uri $URL -OutFile $TmpExe
112
112
  $downloaded = $true
113
113
  } catch {
114
- Write-Fail "Could not download $URL`n$_"
114
+ if ($Version -eq "latest") {
115
+ Write-Fail "Failed to download latest release. Try again later.`n $URL"
116
+ } else {
117
+ Write-Fail "Version $Version not found or binary not available for $Target.`n $URL"
118
+ }
115
119
  }
116
120
  }
117
121
 
package/install.sh CHANGED
@@ -98,71 +98,103 @@ exe="$bin_dir/futrou$exe_ext"
98
98
 
99
99
  mkdir -p "$bin_dir" || error "Failed to create install directory \"$bin_dir\""
100
100
 
101
+ tildify() {
102
+ [[ $1 == $HOME/* ]] && echo "~/${1#$HOME/}" || echo "$1"
103
+ }
104
+
101
105
  # ---------------------------------------------------------------------------
102
- # Detect existing installation and decide action label
106
+ # Detect existing installation
103
107
  # ---------------------------------------------------------------------------
104
- action="Installing"
105
108
  current_version=""
106
-
107
109
  if [[ -x "$exe" ]]; then
108
110
  current_version=$("$exe" --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)
109
111
  fi
110
112
 
111
- if [[ -n "$current_version" && "$version" != "latest" ]]; then
112
- target_version="${version#v}"
113
- if [[ "$current_version" == "$target_version" ]]; then
114
- info "Futrou CLI v$current_version is already installed at $exe"
115
- exit 0
116
- fi
117
-
118
- # Compare semver: split into parts and compare numerically
119
- IFS='.' read -r cur_maj cur_min cur_pat <<< "$current_version"
120
- IFS='.' read -r tgt_maj tgt_min tgt_pat <<< "$target_version"
113
+ # ---------------------------------------------------------------------------
114
+ # Download to a temp file then atomically replace (avoids "Text file busy"
115
+ # when upgrading a running binary)
116
+ # ---------------------------------------------------------------------------
117
+ tmp_exe="$bin_dir/.futrou-tmp$exe_ext"
121
118
 
122
- if (( tgt_maj > cur_maj )) || \
123
- (( tgt_maj == cur_maj && tgt_min > cur_min )) || \
124
- (( tgt_maj == cur_maj && tgt_min == cur_min && tgt_pat > cur_pat )); then
125
- action="Upgrading"
119
+ do_download() {
120
+ local url="$1" dest="$2"
121
+ if command -v curl >/dev/null 2>&1; then
122
+ curl --fail --location --silent --output "$dest" "$url"
123
+ elif command -v wget >/dev/null 2>&1; then
124
+ wget -q -O "$dest" "$url"
126
125
  else
127
- action="Downgrading"
126
+ error "curl or wget is required to install Futrou CLI"
128
127
  fi
129
- elif [[ -n "$current_version" ]]; then
130
- action="Upgrading"
131
- fi
128
+ }
132
129
 
133
- display_version="${version#v}"
130
+ # Spinner shown while downloading
131
+ spinner_pid=""
132
+ if [[ -t 1 ]]; then
133
+ (
134
+ frames='⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
135
+ i=0
136
+ while true; do
137
+ printf "\r${Dim}%s Checking versions...${Color_Off}" "${frames:$((i % ${#frames})):1}"
138
+ sleep 0.08
139
+ (( i++ )) || true
140
+ done
141
+ ) &
142
+ spinner_pid=$!
143
+ else
144
+ printf "${Dim}Checking versions...${Color_Off}\n"
145
+ fi
134
146
 
135
- if [[ -n "$current_version" ]]; then
147
+ if ! do_download "$download_url" "$tmp_exe"; then
148
+ [[ -n "$spinner_pid" ]] && kill "$spinner_pid" 2>/dev/null && printf "\r\033[K"
149
+ rm -f "$tmp_exe"
136
150
  if [[ $version == "latest" ]]; then
137
- info "$action Futrou CLI v$current_version latest"
151
+ error "Failed to download latest release. Try again later.\n $download_url"
138
152
  else
139
- info "$action Futrou CLI v$current_version v$display_version"
153
+ error "Version $version not found or binary not available for $target.\n $download_url"
140
154
  fi
141
- else
142
- if [[ $version == "latest" ]]; then
143
- info "Installing Futrou CLI latest"
155
+ fi
156
+
157
+ chmod +x "$tmp_exe"
158
+
159
+ # Stop spinner
160
+ if [[ -n "$spinner_pid" ]]; then
161
+ kill "$spinner_pid" 2>/dev/null
162
+ wait "$spinner_pid" 2>/dev/null || true
163
+ printf "\r\033[K"
164
+ fi
165
+
166
+ # Read new version from downloaded binary
167
+ new_version=$("$tmp_exe" --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)
168
+
169
+ # Already up to date?
170
+ if [[ -n "$current_version" && "$new_version" == "$current_version" ]]; then
171
+ rm -f "$tmp_exe"
172
+ success "Futrou CLI is already the latest version v$current_version."
173
+ exit 0
174
+ fi
175
+
176
+ # Decide action label now that we know both versions
177
+ action="Installing"
178
+ if [[ -n "$current_version" && -n "$new_version" ]]; then
179
+ IFS='.' read -r cur_maj cur_min cur_pat <<< "$current_version"
180
+ IFS='.' read -r new_maj new_min new_pat <<< "$new_version"
181
+ if (( new_maj > cur_maj )) || \
182
+ (( new_maj == cur_maj && new_min > cur_min )) || \
183
+ (( new_maj == cur_maj && new_min == cur_min && new_pat > cur_pat )); then
184
+ action="Upgrading"
144
185
  else
145
- info "Installing Futrou CLI v$display_version"
186
+ action="Downgrading"
146
187
  fi
188
+ elif [[ -n "$current_version" ]]; then
189
+ action="Upgrading"
147
190
  fi
148
191
 
149
- # ---------------------------------------------------------------------------
150
- # Download to a temp file then atomically replace (avoids "Text file busy"
151
- # when upgrading a running binary)
152
- # ---------------------------------------------------------------------------
153
- tmp_exe="$bin_dir/.futrou-tmp$exe_ext"
154
-
155
- if command -v curl >/dev/null 2>&1; then
156
- curl --fail --location --progress-bar --output "$tmp_exe" "$download_url" ||
157
- error "Failed to download from \"$download_url\""
158
- elif command -v wget >/dev/null 2>&1; then
159
- wget -q --show-progress -O "$tmp_exe" "$download_url" ||
160
- error "Failed to download from \"$download_url\""
192
+ if [[ -n "$current_version" ]]; then
193
+ info "$action Futrou CLI v$current_version v$new_version"
161
194
  else
162
- error "curl or wget is required to install Futrou CLI"
195
+ info "Installing Futrou CLI v$new_version"
163
196
  fi
164
197
 
165
- chmod +x "$tmp_exe"
166
198
  mv -f "$tmp_exe" "$exe"
167
199
 
168
200
  # ---------------------------------------------------------------------------
@@ -176,7 +208,11 @@ case $action in
176
208
  Downgrading) action_past="downgraded" ;;
177
209
  *) action_past="installed" ;;
178
210
  esac
179
- success "Futrou CLI v$installed_version $action_past to $exe"
211
+ if [[ -n "$current_version" && "$action" != "Installing" ]]; then
212
+ success "Futrou CLI v$current_version $action_past v$installed_version"
213
+ else
214
+ success "Futrou CLI v$installed_version $action_past"
215
+ fi
180
216
 
181
217
  # ---------------------------------------------------------------------------
182
218
  # PATH setup (skip if already in PATH)
@@ -187,10 +223,6 @@ if command -v futrou >/dev/null 2>&1; then
187
223
  exit 0
188
224
  fi
189
225
 
190
- tildify() {
191
- [[ $1 == $HOME/* ]] && echo "~/${1#$HOME/}" || echo "$1"
192
- }
193
-
194
226
  tilde_bin_dir=$(tildify "$bin_dir")
195
227
  quoted_install_dir="\"${install_dir//\"/\\\"}\""
196
228
  [[ $quoted_install_dir == \"$HOME/* ]] && quoted_install_dir="${quoted_install_dir/$HOME\//\$HOME/}"
@@ -258,7 +290,10 @@ bash)
258
290
  esac
259
291
 
260
292
  echo
261
- info "To get started, run:"
293
+ info "Reload your shell to use futrou:"
294
+ info_bold " exec \$SHELL"
295
+ echo
296
+ info "Or open a new terminal and run:"
262
297
  info_bold " futrou --help"
263
298
 
264
299
  # Make futrou available in the current shell session without restarting
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "futrou",
3
3
  "productName": "Futrou CLI",
4
- "version": "2.0.8",
4
+ "version": "2.0.10",
5
5
  "description": "Futrou CLI - Deploy and manage Futrou Cloud from your terminal.",
6
6
  "bin": {
7
7
  "futrou": "./index.cjs",