electrobun 0.0.19-beta.11 → 0.0.19-beta.13

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.
Files changed (2) hide show
  1. package/bin/electrobun.cjs +37 -5
  2. package/package.json +1 -1
@@ -62,8 +62,22 @@ async function downloadFile(url, filePath) {
62
62
  }
63
63
 
64
64
  async function ensureCliBinary() {
65
+ // Check if CLI binary exists in bin location (where npm expects it)
66
+ const binLocation = join(electrobunDir, 'bin', 'electrobun' + binExt);
67
+ if (existsSync(binLocation)) {
68
+ return binLocation;
69
+ }
70
+
71
+ // Check if core dependencies already exist in cache
65
72
  if (existsSync(cliBinary)) {
66
- return cliBinary;
73
+ // Copy to bin location if it exists in cache but not in bin
74
+ mkdirSync(dirname(binLocation), { recursive: true });
75
+ const fs = require('fs');
76
+ fs.copyFileSync(cliBinary, binLocation);
77
+ if (platform !== 'win') {
78
+ chmodSync(binLocation, '755');
79
+ }
80
+ return binLocation;
67
81
  }
68
82
 
69
83
  console.log('Downloading electrobun CLI for your platform...');
@@ -80,23 +94,41 @@ async function ensureCliBinary() {
80
94
  // Download tarball
81
95
  await downloadFile(tarballUrl, tarballPath);
82
96
 
83
- // Extract CLI binary
97
+ // Extract CLI binary
84
98
  await tar.x({
85
99
  file: tarballPath,
86
- cwd: cacheDir,
87
- strip: 1 // Remove the top-level directory
100
+ cwd: cacheDir
101
+ // No strip needed - CLI tarball contains just the binary
88
102
  });
89
103
 
90
104
  // Clean up tarball
91
105
  unlinkSync(tarballPath);
92
106
 
107
+ // Check if CLI binary was extracted
108
+ if (!existsSync(cliBinary)) {
109
+ throw new Error(`CLI binary not found at ${cliBinary} after extraction`);
110
+ }
111
+
93
112
  // Make executable on Unix systems
94
113
  if (platform !== 'win') {
95
114
  chmodSync(cliBinary, '755');
96
115
  }
97
116
 
117
+ // Copy CLI to bin location so npm scripts can find it
118
+ const binLocation = join(electrobunDir, 'bin', 'electrobun' + binExt);
119
+ mkdirSync(dirname(binLocation), { recursive: true });
120
+
121
+ // Copy the downloaded CLI to replace this script
122
+ const fs = require('fs');
123
+ fs.copyFileSync(cliBinary, binLocation);
124
+
125
+ // Make the bin location executable too
126
+ if (platform !== 'win') {
127
+ chmodSync(binLocation, '755');
128
+ }
129
+
98
130
  console.log('electrobun CLI downloaded successfully!');
99
- return cliBinary;
131
+ return binLocation;
100
132
 
101
133
  } catch (error) {
102
134
  throw new Error(`Failed to download electrobun CLI: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.0.19-beta.11",
3
+ "version": "0.0.19-beta.13",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",