xpose-cli 0.4.0 → 0.4.5
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/bin/install.js +25 -1
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -5,6 +5,7 @@ const path = require('path');
|
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const https = require('https');
|
|
7
7
|
const crypto = require('crypto');
|
|
8
|
+
const { execSync } = require('child_process');
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* xpose binary downloader
|
|
@@ -31,6 +32,7 @@ function getReleaseName() {
|
|
|
31
32
|
'linux-x64': 'x86_64-unknown-linux-musl',
|
|
32
33
|
'darwin-x64': 'x86_64-apple-darwin',
|
|
33
34
|
'darwin-arm64': 'aarch64-apple-darwin',
|
|
35
|
+
'linux-arm64': 'aarch64-unknown-linux-musl',
|
|
34
36
|
'win32-x64': 'x86_64-pc-windows-msvc'
|
|
35
37
|
};
|
|
36
38
|
|
|
@@ -149,7 +151,29 @@ async function download() {
|
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
|
|
152
|
-
console.log(`
|
|
154
|
+
console.log(`Extracting binary...`);
|
|
155
|
+
try {
|
|
156
|
+
// Unpack the tar.gz archive
|
|
157
|
+
// xpose-target.tar.gz usually contains 'xpose' or 'xpose.exe'
|
|
158
|
+
const isWin = os.platform() === 'win32';
|
|
159
|
+
const binName = isWin ? 'xpose.exe' : 'xpose';
|
|
160
|
+
|
|
161
|
+
execSync(`tar -xzf "${dest}" -C "${BIN_DIR}"`);
|
|
162
|
+
|
|
163
|
+
// Ensure permissions on Unix
|
|
164
|
+
if (!isWin) {
|
|
165
|
+
const finalBinPath = path.join(BIN_DIR, binName);
|
|
166
|
+
fs.chmodSync(finalBinPath, 0o755);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Cleanup the archive
|
|
170
|
+
fs.unlinkSync(dest);
|
|
171
|
+
} catch (e) {
|
|
172
|
+
console.error(`❌ Extraction failed: ${e.message}`);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
console.log(`Successfully installed to ${BIN_DIR}`);
|
|
153
177
|
console.log('Note: Run "xpose" to start the tunnel.');
|
|
154
178
|
|
|
155
179
|
} catch (err) {
|