bruno/packages/bruno-electron/notarize.js

36 lines
974 B
JavaScript
Raw Permalink Normal View History

2023-09-13 14:39:59 +02:00
require('dotenv').config({ path: process.env.DOTENV_PATH });
2023-02-22 14:45:37 +01:00
const fs = require('fs');
const path = require('path');
const electron_notarize = require('electron-notarize');
const notarize = async function (params) {
if (process.platform !== 'darwin') {
return;
}
let appId = 'com.usebruno.app';
let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
if (!fs.existsSync(appPath)) {
console.error(`Cannot find application at: ${appPath}`);
return;
}
console.log(`Notarizing ${appId} found at ${appPath} using Apple ID ${process.env.APPLE_ID}`);
try {
await electron_notarize.notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
ascProvider: 'W7LPPWA48L'
});
} catch (error) {
console.error(error);
}
console.log(`Done notarizing ${appId}`);
};
module.exports = notarize;