satoridb 1.1.20 → 1.1.22
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 +10 -9
- package/cli.js +1 -1
- package/package.json +3 -2
- package/postinstall.js +37 -6
- package/verify-install.js +100 -0
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
|
-
|
|
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
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
+
"Binary found at: $BinPath" | Out-File "$env:TEMP\satori-add-path.log" -Append
|
|
32
33
|
} else {
|
|
33
|
-
|
|
34
|
+
"Binary not found at: $BinPath" | Out-File "$env:TEMP\satori-add-path.log" -Append
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
} catch {
|
|
37
|
-
|
|
38
|
-
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "satoridb",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "Install satori",
|
|
5
5
|
"bin": {
|
|
6
6
|
"satoridb": "./cli.js"
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"postinstall.js",
|
|
20
20
|
"add-to-path.ps1",
|
|
21
|
-
"add-to-path.sh"
|
|
21
|
+
"add-to-path.sh",
|
|
22
|
+
"verify-install.js"
|
|
22
23
|
]
|
|
23
24
|
}
|
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
|
-
|
|
164
|
-
"
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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 {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const { spawnSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
const platform = os.platform();
|
|
9
|
+
const binName = platform === "win32" ? "satori.exe" : "satori";
|
|
10
|
+
const installDir = path.join(os.homedir(), ".satori", "bin");
|
|
11
|
+
const binFullPath = path.join(installDir, binName);
|
|
12
|
+
|
|
13
|
+
console.log("🔍 Verifying Satori installation...\n");
|
|
14
|
+
|
|
15
|
+
// Check installation directory
|
|
16
|
+
console.log(`📁 Installation directory: ${installDir}`);
|
|
17
|
+
if (fs.existsSync(installDir)) {
|
|
18
|
+
console.log("✅ Installation directory exists");
|
|
19
|
+
} else {
|
|
20
|
+
console.log("❌ Installation directory does not exist");
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Check binary
|
|
25
|
+
console.log(`\n🔧 Binary: ${binFullPath}`);
|
|
26
|
+
if (fs.existsSync(binFullPath)) {
|
|
27
|
+
console.log("✅ Binary exists");
|
|
28
|
+
|
|
29
|
+
// Check execution permissions on Linux/macOS
|
|
30
|
+
if (platform !== "win32") {
|
|
31
|
+
try {
|
|
32
|
+
const stats = fs.statSync(binFullPath);
|
|
33
|
+
const isExecutable = (stats.mode & fs.constants.S_IXUSR) !== 0;
|
|
34
|
+
if (isExecutable) {
|
|
35
|
+
console.log("✅ Binary has execution permissions");
|
|
36
|
+
} else {
|
|
37
|
+
console.log("⚠️ Binary does not have execution permissions");
|
|
38
|
+
}
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.log("⚠️ Could not verify permissions:", error.message);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
console.log("❌ Binary does not exist");
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Check PATH
|
|
49
|
+
console.log("\n🛣️ Checking PATH...");
|
|
50
|
+
const envPath = process.env.PATH || "";
|
|
51
|
+
const pathEntries = envPath.split(platform === "win32" ? ";" : ":");
|
|
52
|
+
const satoriInPath = pathEntries.some(entry => entry.includes(".satori"));
|
|
53
|
+
|
|
54
|
+
if (satoriInPath) {
|
|
55
|
+
console.log("✅ Satori is in PATH");
|
|
56
|
+
} else {
|
|
57
|
+
console.log("❌ Satori is NOT in PATH");
|
|
58
|
+
console.log(`💡 Manually add: ${installDir} to PATH`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Test direct execution
|
|
62
|
+
console.log("\n🚀 Testing execution...");
|
|
63
|
+
try {
|
|
64
|
+
const result = spawnSync(binFullPath, ["--help"], {
|
|
65
|
+
stdio: "pipe",
|
|
66
|
+
timeout: 5000
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (result.status === 0 || result.status === null) {
|
|
70
|
+
console.log("✅ Binary executes correctly");
|
|
71
|
+
} else {
|
|
72
|
+
console.log("⚠️ Binary executes but returned code:", result.status);
|
|
73
|
+
}
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.log("❌ Error executing binary:", error.message);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Test 'satori' command if in PATH
|
|
79
|
+
if (satoriInPath) {
|
|
80
|
+
console.log("\n🔍 Testing 'satori' command...");
|
|
81
|
+
try {
|
|
82
|
+
const result = spawnSync("satori", ["--help"], {
|
|
83
|
+
stdio: "pipe",
|
|
84
|
+
timeout: 5000
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (result.status === 0) {
|
|
88
|
+
console.log("✅ 'satori' command works correctly");
|
|
89
|
+
} else {
|
|
90
|
+
console.log("⚠️ 'satori' command returned code:", result.status);
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.log("❌ Error executing 'satori' command:", error.message);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log("\n📋 Summary:");
|
|
98
|
+
console.log(`📍 Binary: ${binFullPath}`);
|
|
99
|
+
console.log(`🛣️ In PATH: ${satoriInPath ? "Yes" : "No"}`);
|
|
100
|
+
console.log(`🔄 To use: ${satoriInPath ? "satori" : binFullPath}`);
|