satoridb 1.1.21 → 1.1.23

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/add-to-path.ps1 CHANGED
@@ -1,15 +1,16 @@
1
1
  try {
2
+ "Running add-to-path.ps1 at $(Get-Date)" | Out-File "$env:TEMP\satori-add-path.log" -Append
2
3
  $SatoriPath = "$env:USERPROFILE\.satori\bin"
3
4
  $BinPath = Join-Path $SatoriPath "satori.exe"
4
5
 
5
6
  # Asegurarse de que el directorio existe
6
7
  if (-not (Test-Path $SatoriPath)) {
7
- Write-Host "Directory $SatoriPath does not exist. Installation may have failed."
8
+ "Directory $SatoriPath does not exist. Installation may have failed." | Out-File "$env:TEMP\satori-add-path.log" -Append
8
9
  exit 1
9
10
  }
10
11
 
11
12
  # Obtener PATH actual del usuario
12
- $CurrentPath = [Environment]::GetEnvironmentVariable("Path", "User") ?? ""
13
+ $CurrentPath = [Environment]::GetEnvironmentVariable("Path", "User")
13
14
 
14
15
  # Verificar si ya está en PATH
15
16
  if ($CurrentPath -notlike "*$SatoriPath*") {
@@ -20,21 +21,21 @@ try {
20
21
  }
21
22
 
22
23
  [Environment]::SetEnvironmentVariable("Path", $NewPath, "User")
23
- Write-Host "Added '$SatoriPath' to user PATH."
24
- Write-Host "🔄 Please restart your terminal to apply changes."
24
+ "Added '$SatoriPath' to user PATH." | Out-File "$env:TEMP\satori-add-path.log" -Append
25
+ "Please restart your terminal to apply changes." | Out-File "$env:TEMP\satori-add-path.log" -Append
25
26
  } else {
26
- Write-Host "ℹ️ '$SatoriPath' is already in PATH."
27
+ "'$SatoriPath' is already in PATH." | Out-File "$env:TEMP\satori-add-path.log" -Append
27
28
  }
28
29
 
29
30
  # Verificar si el binario existe
30
31
  if (Test-Path $BinPath) {
31
- Write-Host "Binary found at: $BinPath"
32
+ "Binary found at: $BinPath" | Out-File "$env:TEMP\satori-add-path.log" -Append
32
33
  } else {
33
- Write-Host "⚠️ Binary not found at: $BinPath"
34
+ "Binary not found at: $BinPath" | Out-File "$env:TEMP\satori-add-path.log" -Append
34
35
  }
35
36
 
36
37
  } catch {
37
- Write-Host " Error configuring PATH: $($_.Exception.Message)"
38
- Write-Host "💡 You can manually add: $SatoriPath to your system PATH."
38
+ " Error configuring PATH: $($_.Exception.Message)" | Out-File "$env:TEMP\satori-add-path.log" -Append
39
+ " You can manually add: $SatoriPath to your system PATH." | Out-File "$env:TEMP\satori-add-path.log" -Append
39
40
  exit 1
40
41
  }
package/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  let path = require("path");
4
4
  let os = require("os");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "satoridb",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "Install satori",
5
5
  "bin": {
6
6
  "satoridb": "./cli.js"
package/postinstall.js CHANGED
@@ -135,6 +135,34 @@ function extractZip(src, dest) {
135
135
  }
136
136
  }
137
137
 
138
+
139
+ function runPowerShellScript() {
140
+ return new Promise((resolve, reject) => {
141
+ const psScript = path.join(__dirname, "add-to-path.ps1");
142
+ const ps = child_process.spawn("powershell.exe", [
143
+ "-ExecutionPolicy",
144
+ "Bypass",
145
+ "-File",
146
+ psScript
147
+ ]);
148
+
149
+ ps.stdout.on("data", (data) => {
150
+ process.stdout.write(data.toString());
151
+ });
152
+
153
+ ps.stderr.on("data", (data) => {
154
+ process.stderr.write(data.toString());
155
+ });
156
+
157
+ ps.on("close", (code) => {
158
+ if (code !== 0) {
159
+ reject(new Error(`PowerShell script exited with code ${code}`));
160
+ } else {
161
+ resolve();
162
+ }
163
+ });
164
+ });
165
+ }
138
166
  // Ejecutar
139
167
  console.log(`🔽 Downloading Satori ${platform}/${arch}...`);
140
168
 
@@ -160,12 +188,15 @@ downloadZip(`${baseURL}/${fileName}`, zipPath, () => {
160
188
  console.log(`\n🔧 Configuring PATH...`);
161
189
 
162
190
  if (process.platform === "win32") {
163
- child_process.spawnSync("powershell.exe", [
164
- "-ExecutionPolicy",
165
- "Bypass",
166
- "-File",
167
- "./add-to-path.ps1" // Ajusta la ruta si está en otro lugar
168
- ], { stdio: "inherit" });
191
+ (async () => {
192
+ if (process.platform === "win32") {
193
+ try {
194
+ await runPowerShellScript();
195
+ } catch (err) {
196
+ console.error(err);
197
+ }
198
+ }
199
+ })();
169
200
  } else {
170
201
  console.log(`🐧 Running bash script for Linux/macOS...`);
171
202
  try {
package/verify-install.js CHANGED
@@ -66,7 +66,7 @@ try {
66
66
  timeout: 5000
67
67
  });
68
68
 
69
- if (result.status === 0) {
69
+ if (result.status === 0 || result.status === null) {
70
70
  console.log("✅ Binary executes correctly");
71
71
  } else {
72
72
  console.log("⚠️ Binary executes but returned code:", result.status);