electrobun 0.0.18 → 0.0.19-beta.1

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.
@@ -0,0 +1,67 @@
1
+ # Electrobun Beta Releases
2
+
3
+ ## For Users
4
+
5
+ ### Installing Beta Versions
6
+
7
+ ```bash
8
+ # Install latest beta
9
+ npm install electrobun@beta
10
+
11
+ # Install specific beta version
12
+ npm install electrobun@0.0.19-beta.1
13
+
14
+ # View available versions
15
+ npm view electrobun versions --json
16
+ ```
17
+
18
+ ### Switching Between Stable and Beta
19
+
20
+ ```bash
21
+ # Switch to stable
22
+ npm install electrobun@latest
23
+
24
+ # Switch to beta
25
+ npm install electrobun@beta
26
+ ```
27
+
28
+ ## For Maintainers
29
+
30
+ ### Publishing Beta Releases
31
+
32
+ 1. **Update version:**
33
+ ```bash
34
+ # First beta of a new version
35
+ npm version 0.0.19-beta.1
36
+
37
+ # Increment beta number
38
+ bun npm:version:beta
39
+ ```
40
+
41
+ 2. **Create GitHub Release:**
42
+ ```bash
43
+ git push origin v0.0.19-beta.1
44
+ ```
45
+ Or manually trigger the workflow with the beta tag.
46
+
47
+ 3. **Publish to npm:**
48
+ ```bash
49
+ bun npm:publish:beta
50
+ ```
51
+
52
+ ### Beta Release Workflow
53
+
54
+ 1. Beta versions use semantic versioning: `MAJOR.MINOR.PATCH-beta.NUMBER`
55
+ 2. GitHub Actions automatically marks releases with `-beta` as pre-releases
56
+ 3. npm publishes to the `beta` dist-tag (not `latest`)
57
+ 4. Users on stable versions won't get beta updates
58
+
59
+ ### Promoting Beta to Stable
60
+
61
+ ```bash
62
+ # Update version to stable
63
+ npm version 0.0.19
64
+
65
+ # Publish as latest
66
+ bun npm:publish
67
+ ```
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## What is Electrobun?
10
10
 
11
- > Electrobun is in the **_very_** early stages. We currently only support development on arm macs, it has memory leaks, has no tests, it's not available in npm yet, and many core things are still missing.
11
+ > Electrobun is in the **_very_** early stages. We currently support development on macOS, Windows, and Linux, but it has memory leaks, has no tests, and many core things are still missing. We're actively working on stabilizing cross-platform support.
12
12
 
13
13
  Electrobun aims to be a complete **solution-in-a-box** for building, updating, and shipping ultra fast, tiny, and cross-platform desktop applications written in Typescript.
14
14
  Under the hood it uses <a href="https://bun.sh">bun</a> to execute the main process and to bundle webview typescript, and has native bindings written in <a href="https://ziglang.org/">zig</a>.
@@ -29,21 +29,7 @@ Read about how Electrobun is designed, and why, in our <a href="https://www.elec
29
29
 
30
30
  ## Roadmap
31
31
 
32
- See the detailed <a href="https://github.com/blackboardsh/electrobun/issues/2">detailed Roadmap</a>.
33
-
34
- **High level roadmap**
35
-
36
- | | Milestones | Description |
37
- | :-- | :-------------------- | :-------------------------------------------------------------------------------------------------------------------------------------- |
38
- | ✅ | Core Architecture | Ship a working proof of concept with most of the core architecture wired up |
39
- | ✅ | Packaging and signing | Packaging and code signing for MacOS |
40
- | ✅ | Shipping updates | Integrated auto-updator |
41
- | ✅ | Webview Tag | Cross browser electrobun implementation of the <webview> tag that electron has, for isolated nested webviews |
42
- | ✅ | Port co(lab) | Harden implementation and enough electron parity to migrate <a href="https://colab.sh">https://colab.sh</a> from Electron to Electrobun |
43
- | | Custom Web Runtime | Optionally use a cross-platform web runtime (Chromium) instead of the system's native webview |
44
- | | Intel Mac Builds | build on and distribute to intel macs |
45
- | | API Parity | Accelerate development of Electrobun apis and native integrations to enable apps to migrate from Electron and Tauri |
46
- | | Windows support | build for and distribute to Windows |
32
+ See the <a href="https://github.com/orgs/blackboardsh/projects/5">roadmap</a>
47
33
 
48
34
  ## Contributing
49
35
 
@@ -53,14 +39,55 @@ As we get closer to 1.0.0 I'll probably make guidelines for PRs and stuff. In th
53
39
 
54
40
  Ways to get involved at this early stage:
55
41
 
56
- - Follow us on X for updates <a href="https://twitter.com/BlackboardTech">@BlackboardTech</a>
42
+ - Follow us on X for updates <a href="https://twitter.com/BlackboardTech">@BlackboardTech</a> or <a href="https://bsky.app/profile/yoav.codes">@yoav.codes</a>
57
43
  - Join the conversation on <a href="https://discord.gg/ueKE4tjaCE">Discord</a>
58
44
  - Create and participate in Github issues and discussions
59
45
 
60
- ## Building
46
+ ## Development Setup
47
+
48
+ ### Prerequisites
49
+
50
+ **macOS:**
51
+ - Xcode command line tools
52
+ - cmake (install via homebrew: `brew install cmake`)
53
+
54
+ **Windows:**
55
+ - Visual Studio Build Tools or Visual Studio with C++ development tools
56
+ - cmake
57
+
58
+ **Linux:**
59
+ - build-essential package
60
+ - cmake
61
+ - webkit2gtk and GTK development packages
62
+
63
+ ### First-time Setup
64
+
65
+ ```bash
66
+ git clone <repo-url>
67
+ cd electrobun
68
+ bun install
69
+ bun dev:playground:clean
70
+ ```
71
+
72
+ ### Development Workflow
73
+
74
+ ```bash
75
+ # After making changes to source code
76
+ bun dev:playground
77
+
78
+ # If you only changed playground code (not electrobun source)
79
+ bun dev:playground:rerun
80
+
81
+ # If you need a completely fresh start
82
+ bun dev:playground:clean
83
+ ```
84
+
85
+ ### Additional Commands
61
86
 
62
- run `bun run install-zig` to install the right version of zig to vendors/zig
87
+ - `bun dev:playground:canary` - Build and run playground in canary mode
88
+ - `bun build:dev` - Build electrobun in development mode
89
+ - `bun build:release` - Build electrobun in release mode
63
90
 
64
- `bun dev:playground` and `bun dev:playground:canary` will compile everything in electrobun in either dev mode and then compile the playground app in either dev or canary modes and run it.
91
+ ### Debugging
65
92
 
66
- Note: use `lldb <path-to-bundle>/Contents/MacOS/launcher` and then `run` to debug release builds
93
+ **macOS:** Use `lldb <path-to-bundle>/Contents/MacOS/launcher` and then `run` to debug release builds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.0.18",
3
+ "version": "0.0.19-beta.1",
4
4
  "description": "Build ultra fast, tiny, and cross-platform desktop apps with Typescript.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",
@@ -10,8 +10,9 @@
10
10
  "./bun": "./dist/api/bun/index.ts",
11
11
  "./view": "./dist/api/browser/index.ts"
12
12
  },
13
+ "type": "module",
13
14
  "bin": {
14
- "electrobun": "dist/electrobun"
15
+ "electrobun": "dist/npmbin.js"
15
16
  },
16
17
  "homepage": "https://electrobun.dev",
17
18
  "repository": {
@@ -19,36 +20,24 @@
19
20
  "url": "git+https://github.com/blackboardsh/electrobun.git"
20
21
  },
21
22
  "scripts": {
23
+ "postinstall": "node scripts/postinstall.js",
22
24
  "start": "bun src/bun/index.ts",
23
25
  "check-zig-version": "vendors/zig/zig version",
24
- "install-zig": "mkdir -p vendors/zig && curl -L https://ziglang.org/download/0.13.0/zig-macos-aarch64-0.13.0.tar.xz | tar -xJ --strip-components=1 -C vendors/zig zig-macos-aarch64-0.13.0/zig zig-macos-aarch64-0.13.0/lib zig-macos-aarch64-0.13.0/doc",
25
- "build:objc:object": "mkdir -p src/objc/build && clang -c src/objc/objcWrapper.m -o src/objc/build/objcWrapper.o -fobjc-arc -fno-objc-msgsend-selector-stubs",
26
- "build:objc:staticlib": "ar rcs src/zig/build/libObjcWrapper.a src/objc/build/objcWrapper.o",
27
- "build:objc": "bun build:objc:object && bun build:objc:staticlib",
28
- "build:zig": "cd src/zig && ../../vendors/zig/zig build",
29
- "build:zig:trdiff": "cd src/bsdiff && ../../vendors/zig/zig build",
30
- "build:launcher": "cd src/launcher && ../../vendors/zig/zig build",
31
- "build:extractor": "cd src/extractor && ../../vendors/zig/zig build",
32
- "build:zig:release": "cd src/zig && ../../vendors/zig/zig build -Doptimize=ReleaseFast",
33
- "build:zig:trdiff:release": "cd src/bsdiff && ../../vendors/zig/zig build -Doptimize=ReleaseFast",
34
- "build:launcher:release": "cd src/launcher && ../../vendors/zig/zig build -Doptimize=ReleaseSmall",
35
- "build:extractor:release": "cd src/extractor && ../../vendors/zig/zig build -Doptimize=ReleaseSmall",
36
- "build:cli": "bun build src/cli/index.ts --compile --outfile src/cli/build/electrobun",
37
- "build:debug": "npm install && bun build:zig:trdiff && bun build:objc && bun build:zig && bun build:launcher && bun build:extractor && bun build:cli",
38
- "build:release": "bun build:objc && bun build:zig:trdiff:release && bun build:zig:release && bun build:launcher:release && bun build:extractor:release && bun build:cli",
39
- "build:package": "bun build:release && bun ./scripts/copy-to-dist.ts",
40
- "build:dev": "bun build:debug && bun ./scripts/copy-to-dist.ts",
41
- "build:electrobun": "bun build:objc && bun build:zig && bun build:bun",
26
+ "build:dev": "bun build.ts",
27
+ "build:release": "bun build.ts --release",
42
28
  "dev:playground": "bun build:dev && cd playground && npm install && bun build:dev && bun start",
29
+ "dev:playground:linux": "bun build:dev && npm link && cd playground && npm link electrobun && bun build:dev && bun start",
30
+ "dev:playground:clean": "cd playground && rm -rf node_modules && npm install && cd .. && bun dev:playground",
43
31
  "dev:playground:rerun": "cd playground && bun start",
44
- "dev:playground:canary": "bun build:package && cd playground && npm install && bun build:canary && bun start:canary",
32
+ "dev:playground:canary": "bun build:release && cd playground && npm install && bun build:canary && bun start:canary",
45
33
  "dev:docs": "cd documentation && bun start",
46
34
  "build:docs:release": "cd documentation && bun run build",
47
- "npm:publish": "bun build:package && npm publish"
35
+ "npm:publish": "bun build:release && npm publish",
36
+ "npm:publish:beta": "bun build:release && npm publish --tag beta",
37
+ "npm:version:beta": "npm version prerelease --preid=beta"
48
38
  },
49
39
  "devDependencies": {
50
- "@types/bun": "1.1.9",
51
- "bun": "1.1.29"
40
+ "@types/bun": "1.1.9"
52
41
  },
53
42
  "dependencies": {
54
43
  "@oneidentity/zstd-js": "^1.0.3",
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import https from 'https';
6
+ import { createWriteStream } from 'fs';
7
+ import { pipeline } from 'stream';
8
+ import { promisify } from 'util';
9
+ import tar from 'tar';
10
+ import { execSync } from 'child_process';
11
+ import { fileURLToPath } from 'url';
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = path.dirname(__filename);
15
+
16
+ const pipelineAsync = promisify(pipeline);
17
+
18
+ const REPO = 'blackboardsh/electrobun';
19
+ const DIST_DIR = path.join(__dirname, '..', 'dist');
20
+
21
+ function getPlatform() {
22
+ const platform = process.platform;
23
+ const arch = process.arch;
24
+
25
+ // Map Node.js platform/arch to our naming
26
+ const platformMap = {
27
+ 'darwin': 'darwin',
28
+ 'linux': 'linux',
29
+ 'win32': 'win32'
30
+ };
31
+
32
+ const archMap = {
33
+ 'x64': 'x64',
34
+ 'arm64': 'arm64'
35
+ };
36
+
37
+ return {
38
+ platform: platformMap[platform] || platform,
39
+ arch: archMap[arch] || arch
40
+ };
41
+ }
42
+
43
+ async function downloadFile(url, dest) {
44
+ return new Promise((resolve, reject) => {
45
+ https.get(url, { headers: { 'User-Agent': 'electrobun-installer' } }, (response) => {
46
+ if (response.statusCode === 302 || response.statusCode === 301) {
47
+ // Follow redirect
48
+ downloadFile(response.headers.location, dest).then(resolve).catch(reject);
49
+ return;
50
+ }
51
+
52
+ if (response.statusCode !== 200) {
53
+ reject(new Error(`Failed to download: ${response.statusCode}`));
54
+ return;
55
+ }
56
+
57
+ const file = createWriteStream(dest);
58
+ response.pipe(file);
59
+
60
+ file.on('finish', () => {
61
+ file.close();
62
+ resolve();
63
+ });
64
+
65
+ file.on('error', (err) => {
66
+ fs.unlinkSync(dest);
67
+ reject(err);
68
+ });
69
+ }).on('error', reject);
70
+ });
71
+ }
72
+
73
+ async function getLatestRelease() {
74
+ return new Promise((resolve, reject) => {
75
+ const options = {
76
+ hostname: 'api.github.com',
77
+ path: `/repos/${REPO}/releases/latest`,
78
+ headers: {
79
+ 'User-Agent': 'electrobun-installer',
80
+ 'Accept': 'application/vnd.github.v3+json'
81
+ }
82
+ };
83
+
84
+ https.get(options, (res) => {
85
+ let data = '';
86
+ res.on('data', chunk => data += chunk);
87
+ res.on('end', () => {
88
+ try {
89
+ const release = JSON.parse(data);
90
+ resolve(release.tag_name);
91
+ } catch (err) {
92
+ reject(err);
93
+ }
94
+ });
95
+ }).on('error', reject);
96
+ });
97
+ }
98
+
99
+ async function main() {
100
+ try {
101
+ // Skip if running in CI or if binaries already exist
102
+ if (process.env.CI || process.env.ELECTROBUN_SKIP_DOWNLOAD) {
103
+ console.log('Skipping binary download');
104
+ return;
105
+ }
106
+
107
+ // Check if dist already exists with binaries
108
+ if (fs.existsSync(path.join(DIST_DIR, 'electrobun'))) {
109
+ console.log('Binaries already exist, skipping download');
110
+ return;
111
+ }
112
+
113
+ const { platform, arch } = getPlatform();
114
+ const binaryName = `electrobun-${platform}-${arch}`;
115
+
116
+ console.log(`Downloading Electrobun binaries for ${platform}-${arch}...`);
117
+
118
+ // Get the latest release tag
119
+ const version = process.env.ELECTROBUN_VERSION || await getLatestRelease();
120
+
121
+ const downloadUrl = `https://github.com/${REPO}/releases/download/${version}/${binaryName}.tar.gz`;
122
+ const tempFile = path.join(__dirname, `${binaryName}.tar.gz`);
123
+
124
+ // Download the tarball
125
+ console.log(`Downloading from ${downloadUrl}...`);
126
+ await downloadFile(downloadUrl, tempFile);
127
+
128
+ // Create dist directory if it doesn't exist
129
+ if (!fs.existsSync(DIST_DIR)) {
130
+ fs.mkdirSync(DIST_DIR, { recursive: true });
131
+ }
132
+
133
+ // Extract the tarball
134
+ console.log('Extracting binaries...');
135
+ await tar.x({
136
+ file: tempFile,
137
+ cwd: DIST_DIR
138
+ });
139
+
140
+ // Clean up
141
+ fs.unlinkSync(tempFile);
142
+
143
+ // Make binaries executable on Unix-like systems
144
+ if (platform !== 'win32') {
145
+ const binaries = ['bun', 'electrobun', 'launcher', 'extractor', 'bsdiff', 'bspatch', 'process_helper'];
146
+ binaries.forEach(bin => {
147
+ const binPath = path.join(DIST_DIR, bin);
148
+ if (fs.existsSync(binPath)) {
149
+ fs.chmodSync(binPath, 0o755);
150
+ }
151
+ });
152
+ }
153
+
154
+ console.log('Electrobun installed successfully!');
155
+
156
+ } catch (error) {
157
+ console.error('Failed to download Electrobun binaries:', error.message);
158
+ console.error('You can manually download from: https://github.com/blackboardsh/electrobun/releases');
159
+ // Don't fail the installation
160
+ process.exit(0);
161
+ }
162
+ }
163
+
164
+ // Run main function
165
+ main();
@@ -0,0 +1,34 @@
1
+ #!/bin/bash
2
+
3
+ # Test npm installation locally
4
+ echo "Testing Electrobun npm installation..."
5
+
6
+ # Create a temporary test directory
7
+ TEST_DIR=$(mktemp -d)
8
+ cd $TEST_DIR
9
+
10
+ echo "Test directory: $TEST_DIR"
11
+
12
+ # Initialize a test project
13
+ npm init -y
14
+
15
+ # Set environment variable to use specific version
16
+ export ELECTROBUN_VERSION=v0.0.19-beta.1
17
+
18
+ # Install electrobun (will use local package.json)
19
+ npm install file:///home/yoav/code/electrobun
20
+
21
+ # Check if installation worked
22
+ if [ -f "node_modules/electrobun/dist/electrobun" ]; then
23
+ echo "✓ Electrobun CLI installed successfully"
24
+ ./node_modules/.bin/electrobun --version
25
+ else
26
+ echo "✗ Electrobun CLI not found"
27
+ fi
28
+
29
+ # List installed files
30
+ echo -e "\nInstalled files:"
31
+ find node_modules/electrobun -type f -name "*.ts" | head -10
32
+ find node_modules/electrobun/dist -type f | head -10
33
+
34
+ echo -e "\nTest complete. Directory: $TEST_DIR"
@@ -1,10 +0,0 @@
1
- // consider just makeing a shared types file
2
-
3
- export type BuiltinBunToWebviewSchema = {
4
- requests: {
5
- evaluateJavascriptWithResponse: {
6
- params: { script: string };
7
- response: any;
8
- };
9
- };
10
- };