mattermost-desktop/scripts/notarize.js
Guillermo Vayá 395cbf9c9e
[MM-19963] set working directory on start (#1105)
* [MM-19963] set current working directory for the app

* prevent failing if env variables are not setup

* [MM-19963] cwd if not in dev mode and only if necessary, log it if it happens

* fix remove path if no cert is present

* address CR suggestions
2019-11-19 11:31:32 +01:00

29 lines
1 KiB
JavaScript

// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// inspired by https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
require('dotenv').config();
const {notarize} = require('electron-notarize');
const config = require('../electron-builder.json');
exports.default = async function notarizing(context) {
const {electronPlatformName, appOutDir} = context;
if (electronPlatformName !== 'darwin' || process.platform !== 'darwin') {
return;
}
const appName = context.packager.appInfo.productFilename;
if (typeof process.env.APPLEID === 'undefined') {
console.log('skipping notarization, remember to setup environment variables for APPLEID and APPLEIDPASS if you want to notarize');
return;
}
await notarize({
// should we change it to appBundleId: 'com.mattermost.desktop',
appBundleId: config.appId,
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEIDPASS,
});
};