electrobun 0.0.19-beta.16 → 0.0.19-beta.18
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/package.json +1 -1
- package/src/cli/index.ts +39 -9
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -92,12 +92,26 @@ const PATHS = {
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
async function ensureCoreDependencies() {
|
|
95
|
-
// Check if core dependencies
|
|
96
|
-
|
|
95
|
+
// Check if all core dependencies exist
|
|
96
|
+
const requiredFiles = [
|
|
97
|
+
PATHS.BUN_BINARY,
|
|
98
|
+
PATHS.LAUNCHER_RELEASE,
|
|
99
|
+
PATHS.MAIN_JS,
|
|
100
|
+
// Platform-specific native wrapper
|
|
101
|
+
OS === 'macos' ? PATHS.NATIVE_WRAPPER_MACOS :
|
|
102
|
+
OS === 'win' ? PATHS.NATIVE_WRAPPER_WIN :
|
|
103
|
+
PATHS.NATIVE_WRAPPER_LINUX
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
const allFilesExist = requiredFiles.every(file => existsSync(file));
|
|
107
|
+
if (allFilesExist) {
|
|
97
108
|
return;
|
|
98
109
|
}
|
|
99
110
|
|
|
100
|
-
|
|
111
|
+
// Show which files are missing
|
|
112
|
+
const missingFiles = requiredFiles.filter(file => !existsSync(file));
|
|
113
|
+
console.log('Core dependencies not found. Missing files:', missingFiles.map(f => f.replace(ELECTROBUN_DEP_PATH, '.')).join(', '));
|
|
114
|
+
console.log('Downloading core binaries...');
|
|
101
115
|
|
|
102
116
|
// Get the current Electrobun version from package.json
|
|
103
117
|
const packageJsonPath = join(ELECTROBUN_DEP_PATH, 'package.json');
|
|
@@ -114,13 +128,13 @@ async function ensureCoreDependencies() {
|
|
|
114
128
|
|
|
115
129
|
const platformName = OS === 'macos' ? 'darwin' : OS === 'win' ? 'win32' : 'linux';
|
|
116
130
|
const archName = ARCH;
|
|
117
|
-
const
|
|
131
|
+
const coreTarballUrl = `https://github.com/blackboardsh/electrobun/releases/download/${version}/electrobun-core-${platformName}-${archName}.tar.gz`;
|
|
118
132
|
|
|
119
|
-
console.log(`Downloading core binaries from: ${
|
|
133
|
+
console.log(`Downloading core binaries from: ${coreTarballUrl}`);
|
|
120
134
|
|
|
121
135
|
try {
|
|
122
|
-
// Download
|
|
123
|
-
const response = await fetch(
|
|
136
|
+
// Download core binaries tarball
|
|
137
|
+
const response = await fetch(coreTarballUrl);
|
|
124
138
|
if (!response.ok) {
|
|
125
139
|
throw new Error(`Failed to download binaries: ${response.status} ${response.statusText}`);
|
|
126
140
|
}
|
|
@@ -477,10 +491,26 @@ if (commandArg === "init") {
|
|
|
477
491
|
// mkdirSync(destLauncherFolder, {recursive: true});
|
|
478
492
|
// }
|
|
479
493
|
// cpSync(zigLauncherBinarySource, zigLauncherDestination, {recursive: true, dereference: true});
|
|
494
|
+
// For dev builds, use the actual CLI binary that's currently running
|
|
495
|
+
// It could be in .cache (npm install) or bin (local dev)
|
|
496
|
+
let devLauncherPath = PATHS.LAUNCHER_DEV;
|
|
497
|
+
if (buildEnvironment === "dev" && !existsSync(devLauncherPath)) {
|
|
498
|
+
// Check .cache location (npm installed)
|
|
499
|
+
const cachePath = join(ELECTROBUN_DEP_PATH, ".cache", "electrobun") + binExt;
|
|
500
|
+
if (existsSync(cachePath)) {
|
|
501
|
+
devLauncherPath = cachePath;
|
|
502
|
+
} else {
|
|
503
|
+
// Check bin location (local dev)
|
|
504
|
+
const binPath = join(ELECTROBUN_DEP_PATH, "bin", "electrobun") + binExt;
|
|
505
|
+
if (existsSync(binPath)) {
|
|
506
|
+
devLauncherPath = binPath;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
480
511
|
const bunCliLauncherBinarySource =
|
|
481
512
|
buildEnvironment === "dev"
|
|
482
|
-
?
|
|
483
|
-
PATHS.LAUNCHER_DEV
|
|
513
|
+
? devLauncherPath
|
|
484
514
|
: // Note: for release use the zig launcher optimized for smol size
|
|
485
515
|
PATHS.LAUNCHER_RELEASE;
|
|
486
516
|
const bunCliLauncherDestination = join(appBundleMacOSPath, "launcher") + binExt;
|