electrobun 0.0.19-beta.12 → 0.0.19-beta.14

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 +29 -10
  2. package/package.json +2 -3
@@ -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...');
@@ -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 cliBinary;
131
+ return binLocation;
105
132
 
106
133
  } catch (error) {
107
134
  throw new Error(`Failed to download electrobun CLI: ${error.message}`);
@@ -111,14 +138,6 @@ async function ensureCliBinary() {
111
138
  async function main() {
112
139
  try {
113
140
  const args = process.argv.slice(2);
114
-
115
- // Handle postinstall flag - just download CLI and exit
116
- if (args.includes('--install-only')) {
117
- await ensureCliBinary();
118
- console.log('electrobun CLI installed successfully!');
119
- return;
120
- }
121
-
122
141
  const cliPath = await ensureCliBinary();
123
142
 
124
143
  // Replace this process with the actual CLI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.0.19-beta.12",
3
+ "version": "0.0.19-beta.14",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "type": "module",
20
20
  "bin": {
21
- "electrobun": "./bin/electrobun"
21
+ "electrobun": "./bin/electrobun.cjs"
22
22
  },
23
23
  "homepage": "https://electrobun.dev",
24
24
  "repository": {
@@ -26,7 +26,6 @@
26
26
  "url": "git+https://github.com/blackboardsh/electrobun.git"
27
27
  },
28
28
  "scripts": {
29
- "postinstall": "node bin/electrobun.cjs --install-only",
30
29
  "build:cli": "mkdir -p bin && bun build src/cli/index.ts --compile --outfile bin/electrobun",
31
30
  "start": "bun src/bun/index.ts",
32
31
  "check-zig-version": "vendors/zig/zig version",