From 2c57f3a43bae3eb8d43f47c0282efe9f7fa8217d Mon Sep 17 00:00:00 2001 From: Alejandro Parcet Date: Fri, 4 Aug 2023 10:18:46 +0200 Subject: [PATCH 1/8] fix: added Mac universal flag to compilation process --- .github/workflows/release.yml | 2 +- .gitignore | 1 + package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4272f6605..60806d9da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -133,7 +133,7 @@ jobs: APPLE_ID: ${{ secrets.APPLEID }} APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - run: yarn run make + run: yarn run make-mac - if: runner.os != 'macOS' name: Build for Linux/Windows run: yarn run make diff --git a/.gitignore b/.gitignore index 11a21cc4a..0d84e1971 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ pids *.seed *.pid.lock .DS_Store +.swp # Directory for instrumented libs generated by jscoverage/JSCover lib-cov diff --git a/package.json b/package.json index beed9ecd6..9ef0bc191 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "package": "electron-forge package", "make": "electron-forge make", "make-win": "electron-forge make --platform win32", - "make-mac": "electron-forge make --platform darwin", + "make-mac": "electron-forge make --platform darwin --arch=universal", "make-lin": "electron-forge make --platform linux", "lint": "eslint --ext .ts,.tsx,.js,.jsx .", "prettier": "prettier --write \"./**/*.{js,json,css,scss,md}\"", From be6fdcdcd0ff805c01ac2647340da12af78c41f5 Mon Sep 17 00:00:00 2001 From: Alejandro Parcet Date: Fri, 4 Aug 2023 10:21:17 +0200 Subject: [PATCH 2/8] fix: added stagign step to the fix --- .github/workflows/staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 276ca334c..ef93ac33a 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -133,7 +133,7 @@ jobs: APPLE_ID: ${{ secrets.APPLEID }} APPLE_ID_PASSWORD: ${{ secrets.APPLEIDPASS }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - run: yarn run make + run: yarn run make-mac - if: runner.os != 'macOS' name: Build for Linux/Windows run: yarn run make From ed8346de06bf7715a1b22b4dc926363e2ec387eb Mon Sep 17 00:00:00 2001 From: Javier Guzman <906599+javierguzman@users.noreply.github.com> Date: Mon, 7 Aug 2023 09:20:45 +0200 Subject: [PATCH 3/8] fix: add x64, arm64 and universal archs to mac target" --- forge.config.ts | 2 +- package.json | 5 ++++- yarn.lock | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/forge.config.ts b/forge.config.ts index e67069afe..1c9729eb7 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -11,7 +11,7 @@ import mainConfig from "./webpack.main.config"; const packagerConfig: ForgePackagerOptions = { appBundleId: "com.dygmalab.bazecor", darwinDarkModeSupport: true, - icon: "./build/logo.png", + icon: "./build/logo", name: "Bazecor", extraResource: ["NEWS.md"], appCopyright: "Copyright © 2018, 2023 DygmaLab SL; distributed under the GPLv3", diff --git a/package.json b/package.json index 9ef0bc191..0c16d43af 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "package": "electron-forge package", "make": "electron-forge make", "make-win": "electron-forge make --platform win32", - "make-mac": "electron-forge make --platform darwin --arch=universal", + "make-mac": "electron-forge make --platform darwin", "make-lin": "electron-forge make --platform linux", "lint": "eslint --ext .ts,.tsx,.js,.jsx .", "prettier": "prettier --write \"./**/*.{js,json,css,scss,md}\"", @@ -57,6 +57,7 @@ "@electron-forge/maker-rpm": "^6.1.1", "@electron-forge/maker-squirrel": "^6.1.1", "@electron-forge/plugin-webpack": "^6.1.1", + "@electron/universal": "^1.4.1", "@playwright/test": "^1.36.0", "@reforged/maker-appimage": "^3.3.0", "@semantic-release/changelog": "^6.0.3", @@ -156,6 +157,8 @@ { "target": "dmg", "arch": [ + "x64", + "arm64", "universal" ] } diff --git a/yarn.lock b/yarn.lock index 586672731..666cea8a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1435,7 +1435,7 @@ minimatch "^3.0.4" plist "^3.0.4" -"@electron/universal@^1.3.2": +"@electron/universal@^1.3.2", "@electron/universal@^1.4.1": version "1.4.1" resolved "https://registry.yarnpkg.com/@electron/universal/-/universal-1.4.1.tgz#3fbda2a5ed9ff9f3304c8e8316b94c1e3a7b3785" integrity sha512-lE/U3UNw1YHuowNbTmKNs9UlS3En3cPgwM5MI+agIgr/B1hSze9NdOP0qn7boZaI9Lph8IDv3/24g9IxnJP7aQ== From 8d31db0730440926c72f2b8b003c98f0658b835c Mon Sep 17 00:00:00 2001 From: Javier Guzman <906599+javierguzman@users.noreply.github.com> Date: Mon, 7 Aug 2023 10:07:35 +0200 Subject: [PATCH 4/8] fix: add osx universal option to forge config --- forge.config.ts | 3 +++ package.json | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/forge.config.ts b/forge.config.ts index 1c9729eb7..82f74b08f 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -13,6 +13,9 @@ const packagerConfig: ForgePackagerOptions = { darwinDarkModeSupport: true, icon: "./build/logo", name: "Bazecor", + osxUniversal: { + x64ArchFiles: "*", + }, extraResource: ["NEWS.md"], appCopyright: "Copyright © 2018, 2023 DygmaLab SL; distributed under the GPLv3", }; diff --git a/package.json b/package.json index 0c16d43af..86533860b 100644 --- a/package.json +++ b/package.json @@ -157,8 +157,6 @@ { "target": "dmg", "arch": [ - "x64", - "arm64", "universal" ] } From 98d8b7fe2f61d79827a18fabead40b6db839e89a Mon Sep 17 00:00:00 2001 From: Javier Guzman <906599+javierguzman@users.noreply.github.com> Date: Mon, 7 Aug 2023 11:17:51 +0200 Subject: [PATCH 5/8] fix: universal build actually being built --- .github/workflows/release.yml | 2 +- .github/workflows/staging.yml | 2 +- package.json | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 60806d9da..da435c52e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -163,7 +163,7 @@ jobs: with: name: artifacts path: | - out/make/**/*.dmg + out/make/**/*universal.dmg out/make/**/*.AppImage windows_signing/**/*.exe diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index ef93ac33a..52803e218 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -166,7 +166,7 @@ jobs: with: name: artifacts path: | - out/make/**/*.dmg + out/make/**/*universal.dmg out/make/**/*.AppImage windows_signing/**/*.exe diff --git a/package.json b/package.json index 86533860b..a041532f5 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,12 @@ "scripts": { "clean": "rm -rf dist && rm -rf out && rm -rf node_modules", "start": "NODE_ENV=development electron-forge start", - "make-dev": "NODE_ENV=development electron-forge make", + "make-dev": "NODE_ENV=development electron-forge make --platform=darwin --arch=universal", "package": "electron-forge package", "make": "electron-forge make", - "make-win": "electron-forge make --platform win32", - "make-mac": "electron-forge make --platform darwin", - "make-lin": "electron-forge make --platform linux", + "make-win": "electron-forge make --platform=win32", + "make-mac": "electron-forge make --platform=darwin --arch=universal", + "make-lin": "electron-forge make --platform=linux", "lint": "eslint --ext .ts,.tsx,.js,.jsx .", "prettier": "prettier --write \"./**/*.{js,json,css,scss,md}\"", "test": "vitest run src/renderer/tests src/main/tests", From 43d45bc11cabcf823394210bf5cf8cc901380f28 Mon Sep 17 00:00:00 2001 From: Javier Guzman <906599+javierguzman@users.noreply.github.com> Date: Mon, 7 Aug 2023 13:15:10 +0200 Subject: [PATCH 6/8] fix: add icon url to windows executable --- forge.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/forge.config.ts b/forge.config.ts index 82f74b08f..d921dc090 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -41,6 +41,7 @@ const config: ForgeConfig = { makers: [ new MakerSquirrel({ setupIcon: "./build/logo.ico", + iconUrl: "https://github.com/Dygmalab/Bazecor/blob/development/build/logo.ico", }), { name: "@electron-forge/maker-dmg", From f3b4836b50f568c8aee61148cc2b4325097081ae Mon Sep 17 00:00:00 2001 From: Javier Guzman <906599+javierguzman@users.noreply.github.com> Date: Mon, 7 Aug 2023 13:38:36 +0200 Subject: [PATCH 7/8] fix: remove icon url --- forge.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/forge.config.ts b/forge.config.ts index d921dc090..82f74b08f 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -41,7 +41,6 @@ const config: ForgeConfig = { makers: [ new MakerSquirrel({ setupIcon: "./build/logo.ico", - iconUrl: "https://github.com/Dygmalab/Bazecor/blob/development/build/logo.ico", }), { name: "@electron-forge/maker-dmg", From cf9a8d24d9267eecf167e615b5fbba5945375f51 Mon Sep 17 00:00:00 2001 From: Javier Guzman <906599+javierguzman@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:09:47 +0200 Subject: [PATCH 8/8] fix: fix screen triggered before ready event --- src/main/createWindow.ts | 6 +++--- src/main/index.ts | 6 +++--- src/main/setup/configureRedirect.ts | 4 ++-- src/main/setup/configureUSB.ts | 1 - 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/createWindow.ts b/src/main/createWindow.ts index 0591a1f8d..950dcaf84 100644 --- a/src/main/createWindow.ts +++ b/src/main/createWindow.ts @@ -16,7 +16,7 @@ import { configureUSB } from "./setup/configureUSB"; declare const MAIN_WINDOW_WEBPACK_ENTRY: string; declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string; -const createWindow = (): void => { +const createWindow = async (): Promise => { // Create the browser window. const mainWindowState = windowStateKeeper({ defaultWidth: 1200, @@ -46,7 +46,7 @@ const createWindow = (): void => { mainWindowState.manage(mainWindow); // and load the index.html of the app. - mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY); + await mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY); Window.getInstance(); // init Windows manager Window.setWindow(mainWindow); @@ -61,7 +61,7 @@ const createWindow = (): void => { onReadyToShow(); onDevTools(); onClose(); - configureUSB(); + await configureUSB(); }; export default createWindow; diff --git a/src/main/index.ts b/src/main/index.ts index 0adb27694..c2562fd93 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -26,7 +26,7 @@ app.on("ready", async () => { setBackup(); setTheme(); // await setDevTools(); devtools do not work with latest electron - createWindow(); + await createWindow(); // we do not want a menu on top of the window Menu.setApplicationMenu(null); }); @@ -41,11 +41,11 @@ app.on("window-all-closed", () => { } }); -app.on("activate", () => { +app.on("activate", async () => { // On OS X it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (BrowserWindow.getAllWindows().length === 0) { - createWindow(); + await createWindow(); } }); diff --git a/src/main/setup/configureRedirect.ts b/src/main/setup/configureRedirect.ts index d3c40e998..781fa96b4 100644 --- a/src/main/setup/configureRedirect.ts +++ b/src/main/setup/configureRedirect.ts @@ -4,7 +4,7 @@ import Window from "../managers/Window"; const configureRedirect = () => { const window = Window.getWindow(); const handleRedirect = (e: any, url: string) => { - if (url != window.webContents.getURL()) { + if (url !== window.webContents.getURL()) { e.preventDefault(); shell.openExternal(url); } @@ -12,7 +12,7 @@ const configureRedirect = () => { window.webContents.on("will-navigate", handleRedirect); - window.webContents.setWindowOpenHandler(details => + window.webContents.setWindowOpenHandler(() => // new-window handler removed in Electron 22 ({ action: "deny" }), ); diff --git a/src/main/setup/configureUSB.ts b/src/main/setup/configureUSB.ts index ff35fac2d..6d33fdd75 100644 --- a/src/main/setup/configureUSB.ts +++ b/src/main/setup/configureUSB.ts @@ -83,5 +83,4 @@ export const configureUSB = async () => { const devices = getDeviceList(); return devices; }); - };