electrobun 0.0.19-beta.62 → 0.0.19-beta.65

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/package.json +1 -1
  2. package/src/cli/index.ts +43 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.0.19-beta.62",
3
+ "version": "0.0.19-beta.65",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",
package/src/cli/index.ts CHANGED
@@ -174,13 +174,36 @@ async function ensureCoreDependencies(targetOS?: 'macos' | 'win' | 'linux', targ
174
174
  // Write response to file
175
175
  if (response.body) {
176
176
  const reader = response.body.getReader();
177
+ let totalBytes = 0;
177
178
  while (true) {
178
179
  const { done, value } = await reader.read();
179
180
  if (done) break;
180
- fileStream.write(Buffer.from(value));
181
+ const buffer = Buffer.from(value);
182
+ fileStream.write(buffer);
183
+ totalBytes += buffer.length;
181
184
  }
185
+ console.log(`Downloaded ${totalBytes} bytes for ${platformOS}-${platformArch}`);
186
+ }
187
+
188
+ // Ensure file is properly closed before proceeding
189
+ await new Promise((resolve, reject) => {
190
+ fileStream.end((err) => {
191
+ if (err) reject(err);
192
+ else resolve(null);
193
+ });
194
+ });
195
+
196
+ // Verify the downloaded file exists and has content
197
+ if (!existsSync(tempFile)) {
198
+ throw new Error(`Downloaded file not found: ${tempFile}`);
199
+ }
200
+
201
+ const fileSize = require('fs').statSync(tempFile).size;
202
+ if (fileSize === 0) {
203
+ throw new Error(`Downloaded file is empty: ${tempFile}`);
182
204
  }
183
- fileStream.end();
205
+
206
+ console.log(`Verified download: ${tempFile} (${fileSize} bytes)`);
184
207
 
185
208
  // Extract to platform-specific dist directory
186
209
  console.log(`Extracting core dependencies for ${platformOS}-${platformArch}...`);
@@ -1486,17 +1509,23 @@ if (commandArg === "init") {
1486
1509
  console.log("bucketUrl: ", config.release.bucketUrl);
1487
1510
 
1488
1511
  console.log("generating a patch from the previous version...");
1489
- const urlToPrevUpdateJson = join(
1490
- config.release.bucketUrl,
1491
- buildEnvironment,
1492
- `update${platformSuffix}.json`
1493
- );
1494
- const cacheBuster = Math.random().toString(36).substring(7);
1495
- const updateJsonResponse = await fetch(
1496
- urlToPrevUpdateJson + `?${cacheBuster}`
1497
- ).catch((err) => {
1498
- console.log("bucketURL not found: ", err);
1499
- });
1512
+
1513
+ // Skip patch generation if bucketUrl is not configured
1514
+ if (!config.release.bucketUrl || config.release.bucketUrl.trim() === '') {
1515
+ console.log("No bucketUrl configured, skipping patch generation");
1516
+ console.log("To enable patch generation, configure bucketUrl in your electrobun.config");
1517
+ } else {
1518
+ const urlToPrevUpdateJson = join(
1519
+ config.release.bucketUrl,
1520
+ buildEnvironment,
1521
+ `update${platformSuffix}.json`
1522
+ );
1523
+ const cacheBuster = Math.random().toString(36).substring(7);
1524
+ const updateJsonResponse = await fetch(
1525
+ urlToPrevUpdateJson + `?${cacheBuster}`
1526
+ ).catch((err) => {
1527
+ console.log("bucketURL not found: ", err);
1528
+ });
1500
1529
 
1501
1530
  const urlToLatestTarball = join(
1502
1531
  config.release.bucketUrl,
@@ -1566,6 +1595,7 @@ if (commandArg === "init") {
1566
1595
  console.log("prevoius version not found at: ", urlToLatestTarball);
1567
1596
  console.log("skipping diff generation");
1568
1597
  }
1598
+ } // End of bucketUrl validation block
1569
1599
 
1570
1600
  // compress all the upload files
1571
1601
  console.log("copying artifacts...");