argonctl 1.0.0 → 1.0.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.
- package/install.js +34 -0
- package/package.json +2 -2
package/install.js
CHANGED
|
@@ -62,6 +62,40 @@ function downloadBinary() {
|
|
|
62
62
|
const file = fs.createWriteStream(binaryPath);
|
|
63
63
|
|
|
64
64
|
https.get(downloadUrl, (response) => {
|
|
65
|
+
// Handle redirects
|
|
66
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
67
|
+
const redirectUrl = response.headers.location;
|
|
68
|
+
console.log(`Following redirect to: ${redirectUrl}`);
|
|
69
|
+
https.get(redirectUrl, (redirectResponse) => {
|
|
70
|
+
if (redirectResponse.statusCode !== 200) {
|
|
71
|
+
reject(new Error(`Failed to download binary: HTTP ${redirectResponse.statusCode}`));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
redirectResponse.pipe(file);
|
|
75
|
+
|
|
76
|
+
file.on('finish', () => {
|
|
77
|
+
file.close();
|
|
78
|
+
|
|
79
|
+
// Make binary executable on Unix systems
|
|
80
|
+
if (process.platform !== 'win32') {
|
|
81
|
+
try {
|
|
82
|
+
fs.chmodSync(binaryPath, '755');
|
|
83
|
+
} catch (err) {
|
|
84
|
+
console.warn('Warning: Could not make binary executable:', err.message);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
console.log('Argon CLI installed successfully!');
|
|
89
|
+
console.log('Run "argon --version" to verify installation.');
|
|
90
|
+
resolve();
|
|
91
|
+
});
|
|
92
|
+
}).on('error', (err) => {
|
|
93
|
+
fs.unlink(binaryPath, () => {}); // Delete partial file
|
|
94
|
+
reject(err);
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
65
99
|
if (response.statusCode !== 200) {
|
|
66
100
|
reject(new Error(`Failed to download binary: HTTP ${response.statusCode}`));
|
|
67
101
|
return;
|
package/package.json
CHANGED