Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mac universal bundle #482

Merged
merged 8 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
with:
name: artifacts
path: |
out/make/**/*.dmg
out/make/**/*universal.dmg
out/make/**/*.AppImage
windows_signing/**/*.exe
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
with:
name: artifacts
path: |
out/make/**/*.dmg
out/make/**/*universal.dmg
out/make/**/*.AppImage
windows_signing/**/*.exe
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pids
*.seed
*.pid.lock
.DS_Store
.swp

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
Expand Down
5 changes: 4 additions & 1 deletion forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import mainConfig from "./webpack.main.config";
const packagerConfig: ForgePackagerOptions = {
appBundleId: "com.dygmalab.bazecor",
darwinDarkModeSupport: true,
icon: "./build/logo.png",
icon: "./build/logo",
name: "Bazecor",
osxUniversal: {
x64ArchFiles: "*",
},
extraResource: ["NEWS.md"],
appCopyright: "Copyright © 2018, 2023 DygmaLab SL; distributed under the GPLv3",
};
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/main/createWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
// Create the browser window.
const mainWindowState = windowStateKeeper({
defaultWidth: 1200,
Expand Down Expand Up @@ -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);
Expand All @@ -61,7 +61,7 @@ const createWindow = (): void => {
onReadyToShow();
onDevTools();
onClose();
configureUSB();
await configureUSB();
};

export default createWindow;
6 changes: 3 additions & 3 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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();
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/main/setup/configureRedirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ 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);
}
};

window.webContents.on("will-navigate", handleRedirect);

window.webContents.setWindowOpenHandler(details =>
window.webContents.setWindowOpenHandler(() =>
// new-window handler removed in Electron 22
({ action: "deny" }),
);
Expand Down
1 change: 0 additions & 1 deletion src/main/setup/configureUSB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,4 @@ export const configureUSB = async () => {
const devices = getDeviceList();
return devices;
});

};
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand Down