electrobun 0.0.19-beta.12 → 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.
- package/bin/electrobun.cjs +29 -2
- package/package.json +1 -1
package/bin/electrobun.cjs
CHANGED
|
@@ -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
|
-
|
|
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...');
|
|
@@ -100,8 +114,21 @@ async function ensureCliBinary() {
|
|
|
100
114
|
chmodSync(cliBinary, '755');
|
|
101
115
|
}
|
|
102
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
|
+
|
|
103
130
|
console.log('electrobun CLI downloaded successfully!');
|
|
104
|
-
return
|
|
131
|
+
return binLocation;
|
|
105
132
|
|
|
106
133
|
} catch (error) {
|
|
107
134
|
throw new Error(`Failed to download electrobun CLI: ${error.message}`);
|
package/package.json
CHANGED