Skip to content

Commit

Permalink
MAC x64 dmg is no longer generated #190
Browse files Browse the repository at this point in the history
Try to package x64 mac

MAC x64 dmg is no longer generated #190

MAC x64 dmg is no longer generated #190

MAC x64 dmg is no longer generated #190

MAC x64 dmg is no longer generated #190

Update notarization tool #191

Double click doesn't work in macOS #183

Use notarytool

Add appleApiKeyId for notarize

Add appleApiKeyId for notarize

Add appleApiKeyId for notarize

Add appleApiKeyId for notarize

Update notarization tool #191

Update notarization tool #191

Double click doesn't work in macOS #183

Update notarization tool #191
  • Loading branch information
stephanebouget committed Jul 1, 2024
1 parent eac0cc2 commit 82021b8
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 35 deletions.
16 changes: 12 additions & 4 deletions app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,19 @@ app.on('will-finish-launching', function () {

if (fileToLoad) {
log.info('fileToLoad');
setTimeout(function () {
if (win && win.webContents && fileToLoad) {

if (win) {
setTimeout(() => {
win.webContents.send('file-open-system', fileToLoad);
}
}, 2000);
}, 2500);
} else {
// if win is not ready, wait for it
app.once('browser-window-created', () => {
setTimeout(() => {
win.webContents.send('file-open-system', fileToLoad);
}, 2500);
});
}
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "khiops-visualization",
"title": "khiops Visualization",
"version": "11.0.6",
"version": "11.0.7",
"description": "Khiops Visualization",
"license": "BSD-3-Clause-Clear",
"repository": "https://github.com/KhiopsML/kv-electron",
Expand Down
11 changes: 10 additions & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@
"entitlementsInherit": "./build/entitlements.mac.plist",
"gatekeeperAssess": false,
"hardenedRuntime": true,
"target": ["dmg", "zip"],
"target": [
{
"target": "dmg",
"arch": ["x64", "arm64"]
},
{
"target": "zip",
"arch": ["x64", "arm64"]
}
],
"fileAssociations": [
{
"ext": "khj",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "khiops-visualization",
"title": "khiops Visualization",
"main": "app/main.js",
"version": "11.0.6",
"version": "11.0.7",
"license": "BSD-3-Clause-Clear",
"author": {
"name": "Orange",
Expand Down Expand Up @@ -102,6 +102,7 @@
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"conventional-changelog-cli": "4.1.0",
"@electron/notarize": "2.3.2",
"electron": "30.0.8",
"electron-builder": "24.13.3",
"electron-builder-notarize": "1.5.2",
Expand Down
61 changes: 33 additions & 28 deletions scripts/notarize.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
// See: https://medium.com/@TwitterArchiveEraser/notarize-electron-apps-7a5f988406db

const fs = require('fs');
const path = require('path');
var electron_notarize = require('electron-notarize');
const fs = require("fs");
const path = require("path");
const electron_notarize = require("electron-notarize");

module.exports = async function (params) {
console.log("----------------------------------", params);
var platform = params.packager.platform.name;
// Only notarize the app on Mac OS only.
if (platform === 'linux' || platform === 'windows') {
return;
}
console.log('afterSign hook triggered', params);
console.log("----------------------------------", params);
const platform = params.packager.platform.name;
// Only notarize the app on Mac OS only.
if (platform === "linux" || platform === "windows") {
return;
}
console.log("afterSign hook triggered", params);

// Same appId in electron-builder.
let appId = 'com.khiops.visualization';
// Same appId in electron-builder.
let appId = "com.khiops.visualization";

let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
if (!fs.existsSync(appPath)) {
throw new Error(`Cannot find application at: ${appPath}`);
}
let appPath = path.join(
params.appOutDir,
`${params.packager.appInfo.productFilename}.app`
);
if (!fs.existsSync(appPath)) {
throw new Error(`Cannot find application at: ${appPath}`);
}

console.log(`Notarizing ${appId} found at ${appPath}`);
console.log(`Notarizing ${appId} found at ${appPath}`);

try {
await electron_notarize.notarize({
appBundleId: appId,
appPath: appPath,
appleApiKey: process.env.API_KEY_ID,
appleApiIssuer: process.env.API_KEY_ISSUER_ID
});
} catch (error) {
console.error(error);
}
try {
await electron_notarize.notarize({
tool: "notarytool",
appBundleId: appId,
appPath: appPath,
appleApiKeyId: process.env.API_KEY_ID,
appleApiKey: "~/private_keys/AuthKey_" + process.env.API_KEY_ID + ".p8",
appleApiIssuer: process.env.API_KEY_ISSUER_ID,
});
} catch (error) {
console.error("ERROR during Notarization", error);
}

console.log(`Done notarizing ${appId}`);
console.log(`Done notarizing ${appId}`);
};
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,15 @@
fs-extra "^9.0.1"
promise-retry "^2.0.1"

"@electron/[email protected]":
version "2.3.2"
resolved "https://registry.yarnpkg.com/@electron/notarize/-/notarize-2.3.2.tgz#20a52a961747be8542a35003380988a0d3fe15e6"
integrity sha512-zfayxCe19euNwRycCty1C7lF7snk9YwfRpB5M8GLr1a4ICH63znxaPNAubrMvj0yDvVozqfgsdYpXVUnpWBDpg==
dependencies:
debug "^4.1.1"
fs-extra "^9.0.1"
promise-retry "^2.0.1"

"@electron/[email protected]":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@electron/osx-sign/-/osx-sign-1.0.5.tgz#0af7149f2fce44d1a8215660fd25a9fb610454d8"
Expand Down

0 comments on commit 82021b8

Please sign in to comment.