mirror of
https://github.com/standardnotes/app.git
synced 2026-01-11 19:56:41 +00:00
36 lines
1 KiB
JavaScript
36 lines
1 KiB
JavaScript
/** @see: https://medium.com/@TwitterArchiveEraser/notarize-electron-apps-7a5f988406db */
|
|
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
const electronNotarize = require('electron-notarize')
|
|
|
|
module.exports = async function (params) {
|
|
const platformName = params.electronPlatformName
|
|
if (platformName !== 'darwin') {
|
|
return
|
|
}
|
|
console.log('afterSign hook triggered')
|
|
|
|
const { appId } = JSON.parse(await fs.promises.readFile('./package.json')).build
|
|
|
|
const appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`)
|
|
await fs.promises.access(appPath)
|
|
|
|
console.log(`Notarizing ${appId} found at ${appPath}`)
|
|
|
|
try {
|
|
electronNotarize
|
|
.notarize({
|
|
appBundleId: appId,
|
|
appPath: appPath,
|
|
appleId: process.env.notarizeAppleId,
|
|
appleIdPassword: process.env.notarizeAppleIdPassword,
|
|
})
|
|
.then(() => {
|
|
console.log(`Done notarizing ${appId}`)
|
|
})
|
|
} catch (error) {
|
|
console.error(error)
|
|
throw error
|
|
}
|
|
}
|