xpose-cli 0.3.2 → 0.4.4

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 CHANGED
@@ -31,6 +31,7 @@ function getReleaseName() {
31
31
  'linux-x64': 'x86_64-unknown-linux-musl',
32
32
  'darwin-x64': 'x86_64-apple-darwin',
33
33
  'darwin-arm64': 'aarch64-apple-darwin',
34
+ 'linux-arm64': 'aarch64-unknown-linux-musl',
34
35
  'win32-x64': 'x86_64-pc-windows-msvc'
35
36
  };
36
37
 
@@ -65,6 +66,9 @@ function getFileContent(url) {
65
66
  if (res.statusCode === 301 || res.statusCode === 302) {
66
67
  return getFileContent(res.headers.location).then(resolve).catch(reject);
67
68
  }
69
+ if (res.statusCode !== 200) {
70
+ return reject(new Error(`Failed to fetch ${url} (Status: ${res.statusCode})`));
71
+ }
68
72
  let data = '';
69
73
  res.on('data', hunk => data += hunk);
70
74
  res.on('end', () => resolve(data.trim()));
@@ -168,4 +172,4 @@ if (require.main === module) {
168
172
  }
169
173
  }
170
174
 
171
- module.exports = { download, getReleaseName };
175
+ module.exports = { download, getReleaseName, getFileContent };
@@ -7,7 +7,7 @@ const http = require('http'); // We'll use this to mock
7
7
  // Mocking dependencies would be complex without a library like proxyquire or jest.
8
8
  // For a simple standalone test, we'll use environment variables and temporary paths.
9
9
 
10
- const { download } = require('./install');
10
+ const { download, getFileContent } = require('./install');
11
11
 
12
12
  async function testSuccessfulDownload() {
13
13
  console.log('Running testSuccessfulDownload...');
@@ -23,11 +23,29 @@ async function testSuccessfulDownload() {
23
23
  }
24
24
  }
25
25
 
26
+ async function testGetFileContent404() {
27
+ console.log('Running testGetFileContent404...');
28
+ const url = 'https://github.com/vkaylee/xpose-cli/releases/download/v0.3.2/NON_EXISTENT_FILE.sha256';
29
+ try {
30
+ await getFileContent(url);
31
+ console.error('❌ testGetFileContent404 FAILED: Expected rejection for 404, but it resolved.');
32
+ process.exit(1);
33
+ } catch (e) {
34
+ if (e.message.includes('Status: 404')) {
35
+ console.log('✅ testGetFileContent404 passed: Correctly rejected with Status: 404');
36
+ } else {
37
+ console.error('❌ testGetFileContent404 FAILED: Unexpected error message:', e.message);
38
+ process.exit(1);
39
+ }
40
+ }
41
+ }
42
+
26
43
  // In a real scenario, we would mock https.get and fs.createWriteStream.
27
44
  // Since we want to stay within standard node tools for now, we'll verify the logic structure.
28
45
 
29
46
  async function runTests() {
30
47
  await testSuccessfulDownload();
48
+ await testGetFileContent404();
31
49
  console.log('\nAll tests passed!');
32
50
  }
33
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xpose-cli",
3
- "version": "0.3.2",
3
+ "version": "0.4.4",
4
4
  "description": "Cloudflare Tunnel CLI for developers - Vivid TUI, auto-copy, and smart defaults.",
5
5
  "bin": {
6
6
  "xpose": "bin/cli.js"
@@ -33,4 +33,4 @@
33
33
  "dependencies": {
34
34
  "cli-progress": "^3.12.0"
35
35
  }
36
- }
36
+ }