futrou 2.0.10 → 2.0.11

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
@@ -56,11 +56,9 @@ $Exe = "$BinDir\futrou.exe"
56
56
  $null = New-Item -ItemType Directory -Force -Path $BinDir
57
57
 
58
58
  # ---------------------------------------------------------------------------
59
- # Detect existing installation and decide action label
59
+ # Detect existing installation
60
60
  # ---------------------------------------------------------------------------
61
- $Action = "Installing"
62
61
  $CurrentVersion = $null
63
-
64
62
  if (Test-Path $Exe) {
65
63
  try {
66
64
  $raw = & $Exe --version 2>$null
@@ -68,40 +66,34 @@ if (Test-Path $Exe) {
68
66
  } catch { }
69
67
  }
70
68
 
71
- if ($CurrentVersion -and $Version -ne "latest") {
72
- $TargetVersion = $Version.TrimStart('v')
73
- if ($CurrentVersion -eq $TargetVersion) {
74
- Write-Info "Futrou CLI v$CurrentVersion is already installed at $Exe"
75
- exit 0
76
- }
77
- $cur = [Version]$CurrentVersion
78
- $tgt = [Version]$TargetVersion
79
- $Action = if ($tgt -gt $cur) { "Upgrading" } elseif ($tgt -lt $cur) { "Downgrading" } else { "Reinstalling" }
80
- } elseif ($CurrentVersion) {
81
- $Action = "Upgrading"
82
- }
83
-
84
- $DisplayVersion = if ($Version -eq "latest") { "latest" } else { $Version.TrimStart('v') }
85
-
86
- $DisplayVersionLabel = if ($Version -eq "latest") { "latest" } else { "v$DisplayVersion" }
87
-
88
- if ($CurrentVersion) {
89
- Write-Info "$Action Futrou CLI v$CurrentVersion → $DisplayVersionLabel"
90
- } else {
91
- Write-Info "Installing Futrou CLI $DisplayVersionLabel"
92
- }
93
-
94
69
  # ---------------------------------------------------------------------------
95
- # Download
70
+ # Download with spinner
96
71
  # ---------------------------------------------------------------------------
97
72
  $TmpExe = "$BinDir\futrou-tmp.exe"
98
73
  Remove-Item -Force $TmpExe -ErrorAction SilentlyContinue
99
74
 
75
+ # Spinner job
76
+ $spinnerJob = $null
77
+ if ([Environment]::UserInteractive -and -not [Console]::IsOutputRedirected) {
78
+ $spinnerJob = Start-Job -ScriptBlock {
79
+ $frames = '⠋','⠙','⠹','⠸','⠼','⠴','⠦','⠧','⠇','⠏'
80
+ $i = 0
81
+ while ($true) {
82
+ $f = $frames[$i % $frames.Count]
83
+ [Console]::Write("`r$f Checking versions...")
84
+ Start-Sleep -Milliseconds 80
85
+ $i++
86
+ }
87
+ }
88
+ } else {
89
+ Write-Info "Checking versions..."
90
+ }
91
+
100
92
  $downloaded = $false
101
93
 
102
94
  if (-not $DownloadWithoutCurl) {
103
95
  try {
104
- curl.exe "-#SfLo" $TmpExe $URL
96
+ curl.exe "-#SfLo" $TmpExe $URL 2>$null
105
97
  if ($LASTEXITCODE -eq 0) { $downloaded = $true }
106
98
  } catch { }
107
99
  }
@@ -110,12 +102,21 @@ if (-not $downloaded) {
110
102
  try {
111
103
  Invoke-RestMethod -Uri $URL -OutFile $TmpExe
112
104
  $downloaded = $true
113
- } catch {
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
- }
105
+ } catch { }
106
+ }
107
+
108
+ # Stop spinner
109
+ if ($spinnerJob) {
110
+ Stop-Job $spinnerJob -ErrorAction SilentlyContinue
111
+ Remove-Job $spinnerJob -ErrorAction SilentlyContinue
112
+ [Console]::Write("`r" + (" " * 40) + "`r")
113
+ }
114
+
115
+ if (-not $downloaded) {
116
+ if ($Version -eq "latest") {
117
+ Write-Fail "Failed to download latest release. Try again later.`n $URL"
118
+ } else {
119
+ Write-Fail "Version $Version not found or binary not available for $Target.`n $URL"
119
120
  }
120
121
  }
121
122
 
@@ -123,6 +124,38 @@ if (-not (Test-Path $TmpExe)) {
123
124
  Write-Fail "Download produced no file. Did antivirus delete it?"
124
125
  }
125
126
 
127
+ # ---------------------------------------------------------------------------
128
+ # Check new version before replacing
129
+ # ---------------------------------------------------------------------------
130
+ $NewVersion = $null
131
+ try {
132
+ $raw = & $TmpExe --version 2>$null
133
+ if ($raw -match '(\d+\.\d+\.\d+)') { $NewVersion = $Matches[1] }
134
+ } catch { }
135
+
136
+ # Already up to date?
137
+ if ($CurrentVersion -and $NewVersion -eq $CurrentVersion) {
138
+ Remove-Item -Force $TmpExe -ErrorAction SilentlyContinue
139
+ Write-Success "Futrou CLI is already the latest version v$CurrentVersion."
140
+ exit 0
141
+ }
142
+
143
+ # Decide action
144
+ $Action = "Installing"
145
+ if ($CurrentVersion -and $NewVersion) {
146
+ $cur = [Version]$CurrentVersion
147
+ $nw = [Version]$NewVersion
148
+ $Action = if ($nw -gt $cur) { "Upgrading" } elseif ($nw -lt $cur) { "Downgrading" } else { "Installing" }
149
+ } elseif ($CurrentVersion) {
150
+ $Action = "Upgrading"
151
+ }
152
+
153
+ if ($CurrentVersion -and $Action -ne "Installing") {
154
+ Write-Info "$Action Futrou CLI v$CurrentVersion → v$NewVersion"
155
+ } else {
156
+ Write-Info "Installing Futrou CLI v$NewVersion"
157
+ }
158
+
126
159
  try { Remove-Item -Force $Exe -ErrorAction SilentlyContinue } catch { }
127
160
  Move-Item -Force $TmpExe $Exe
128
161
 
@@ -140,13 +173,16 @@ if (-not $InstalledVersion) {
140
173
  }
141
174
 
142
175
  $ActionPast = switch ($Action) {
143
- "Installing" { "installed" }
144
176
  "Upgrading" { "upgraded" }
145
177
  "Downgrading" { "downgraded" }
146
178
  default { "installed" }
147
179
  }
148
180
 
149
- Write-Success "Futrou CLI v$InstalledVersion was $ActionPast to $Exe"
181
+ if ($CurrentVersion -and $Action -ne "Installing") {
182
+ Write-Success "Futrou CLI v$CurrentVersion $ActionPast v$InstalledVersion"
183
+ } else {
184
+ Write-Success "Futrou CLI v$InstalledVersion $ActionPast"
185
+ }
150
186
 
151
187
  # ---------------------------------------------------------------------------
152
188
  # PATH update
@@ -183,15 +219,10 @@ if (-not $NoPathUpdate) {
183
219
  if ($CurrentPath -notcontains $BinDir) {
184
220
  $NewPath = ($CurrentPath + $BinDir) -join ';'
185
221
  Set-UserPath $NewPath
186
- $env:PATH = $env:PATH + ";$BinDir"
222
+ $env:PATH = "$BinDir;$env:PATH"
187
223
  Write-Info "Added $BinDir to your PATH"
224
+ Write-Output ""
225
+ Write-Info "Reload your shell to use futrou:"
226
+ Write-Info " Open a new PowerShell window and run: futrou --help"
188
227
  }
189
228
  }
190
-
191
- # Make futrou available in the current session without restarting
192
- if ($env:PATH -notlike "*$BinDir*") {
193
- $env:PATH = "$BinDir;$env:PATH"
194
- }
195
-
196
- Write-Output ""
197
- Write-Output "To get started, run: futrou --help"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "futrou",
3
3
  "productName": "Futrou CLI",
4
- "version": "2.0.10",
4
+ "version": "2.0.11",
5
5
  "description": "Futrou CLI - Deploy and manage Futrou Cloud from your terminal.",
6
6
  "bin": {
7
7
  "futrou": "./index.cjs",