xpose-cli 0.4.4 → 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 +24 -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
|
|
@@ -150,7 +151,29 @@ async function download() {
|
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
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}`);
|
|
154
177
|
console.log('Note: Run "xpose" to start the tunnel.');
|
|
155
178
|
|
|
156
179
|
} catch (err) {
|