electrobun 0.13.0-beta.1 → 0.13.0-beta.3

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 +22 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "0.13.0-beta.1",
3
+ "version": "0.13.0-beta.3",
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
@@ -1093,11 +1093,28 @@ if (commandArg === "init") {
1093
1093
 
1094
1094
  const buildIcons = (appBundleFolderResourcesPath: string) => {
1095
1095
  // Platform-specific icon handling
1096
- if (targetOS === 'macos' && config.build.mac?.icon) {
1097
- const iconPath = join(projectRoot, config.build.mac.icon);
1098
- if (existsSync(iconPath)) {
1099
- const targetIconPath = join(appBundleFolderResourcesPath, "AppIcon.icns");
1100
- cpSync(iconPath, targetIconPath, { dereference: true });
1096
+ if (targetOS === 'macos' && config.build.mac?.icons) {
1097
+ // macOS uses .iconset folders that get converted to .icns using iconutil
1098
+ // This only works when building on macOS since iconutil is a macOS-only tool
1099
+ const iconSourceFolder = join(projectRoot, config.build.mac.icons);
1100
+ const iconDestPath = join(appBundleFolderResourcesPath, "AppIcon.icns");
1101
+ if (existsSync(iconSourceFolder)) {
1102
+ if (OS === 'macos') {
1103
+ // Use iconutil to convert .iconset folder to .icns
1104
+ Bun.spawnSync(
1105
+ ["iconutil", "-c", "icns", "-o", iconDestPath, iconSourceFolder],
1106
+ {
1107
+ cwd: appBundleFolderResourcesPath,
1108
+ stdio: ["ignore", "inherit", "inherit"],
1109
+ env: {
1110
+ ...process.env,
1111
+ ELECTROBUN_BUILD_ENV: buildEnvironment,
1112
+ },
1113
+ }
1114
+ );
1115
+ } else {
1116
+ console.log(`WARNING: Cannot build macOS icons on ${OS} - iconutil is only available on macOS`);
1117
+ }
1101
1118
  }
1102
1119
  } else if (targetOS === 'linux' && config.build.linux?.icon) {
1103
1120
  const iconSourcePath = join(projectRoot, config.build.linux.icon);