Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'electron-notarize' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
import { notarize } from 'electron-notarize'
const projectRoot = require('path').resolve(__dirname, '..')
notarize({
appBundleId: 'com.browserosaurus',
appPath: projectRoot + '/out/Browserosaurus-darwin-x64/Browserosaurus.app',
appleId: String(process.env.APPLE_ID),
appleIdPassword: `@keychain:AC_PASSWORD`,
ascProvider: 'Z89KPMLTFR',
}).catch(e => {
console.error("Didn't work :( " + e.message) // eslint-disable-line no-console
})
async notarizeAppIfSpecified () {
const osxNotarizeOpt = this.opts.osxNotarize
/* istanbul ignore if */
if (osxNotarizeOpt) {
const notarizeOpts = createNotarizeOpts(
osxNotarizeOpt,
this.bundleName,
this.renamedAppPath,
this.opts.quiet
)
if (notarizeOpts) {
return notarize(notarizeOpts)
}
}
}
exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return
}
const appName = context.packager.appInfo.productFilename
const appBundleId = pkg.build.appId
if (appBundleId.length < 3) {
throw Error(`Invalid build.appId: ${appBundleId}`)
}
console.log(`Notarizing the app "${appBundleId}"`)
return await notarize({
appBundleId: appBundleId,
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEIDPASS,
})
}
async function notarizeApp() {
console.log(`afterSign: Notarizing ${appBundleId} in ${appPath}`)
await notarize({
appBundleId,
appPath,
appleId,
appleIdPassword,
ascProvider,
})
console.log('afterSign: Notarized')
}
const {packageJson} = readPkgUp.sync();
const {appId} = packageJson.build;
const appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
const notarizeOptions = {appBundleId: appId, appPath};
if (authInfo.appleId) {
notarizeOptions.appleId = authInfo.appleId;
notarizeOptions.appleIdPassword = authInfo.appleIdPassword;
} else {
notarizeOptions.appleApiKey = authInfo.appleApiKey;
notarizeOptions.appleApiIssuer = authInfo.appleApiIssuer;
}
console.log(`Notarizing ${appId} found at ${appPath}`);
await notarize(notarizeOptions);
console.log(`Done notarizing ${appId}`);
};
'APPLE_API_KEY and APPLE_API_ISSUER env vars are required'
)
}
params.appleApiKey = APPLE_API_KEY
params.appleApiIssuer = APPLE_API_ISSUER
} else {
params.appleId = APPLE_ID
params.appleIdPassword = APPLE_ID_PASS
}
if (ASC_PROVIDER) {
params.ascProvider = ASC_PROVIDER
}
console.log('Notarizing app, coffee time?')
return notarize(params)
}
async function notarizeApp() {
console.log(`afterSign: Notarizing ${appBundleId} in ${appPath}`);
await notarize({
appBundleId,
appPath,
appleId: account.id,
appleIdPassword: account.password,
ascProvider,
});
console.log('afterSign: Notarized');
}
let appPath = path.join(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}`);
try {
const notarizeConfig = {
appBundleId: appId,
appPath: appPath,
appleId: APPLE_ID,
appleIdPassword: APPLE_ID_PASS
};
await notarize(notarizeConfig);
} catch (error) {
console.error(error);
}
console.log(`Done notarizing ${appId}`);
};