Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'electron-osx-sign' 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.
signAppIfSpecified () {
let osxSignOpt = this.opts.osxSign
let platform = this.opts.platform
let version = this.opts.electronVersion
if ((platform === 'all' || platform === 'mas') &&
osxSignOpt === undefined) {
common.warning('signing is required for mas builds. Provide the osx-sign option, ' +
'or manually sign the app later.')
}
if (osxSignOpt) {
const signOpts = createSignOpts(osxSignOpt, platform, this.renamedAppPath, version, this.opts.quiet)
debug(`Running electron-osx-sign with the options ${JSON.stringify(signOpts)}`)
return sign(signOpts)
// Although not signed successfully, the application is packed.
.catch(err => common.warning(`Code sign failed; please retry manually. ${err}`))
} else {
return Promise.resolve()
}
}
async signAppIfSpecified () {
const osxSignOpt = this.opts.osxSign
const platform = this.opts.platform
const version = this.opts.electronVersion
if ((platform === 'all' || platform === 'mas') &&
osxSignOpt === undefined) {
common.warning('signing is required for mas builds. Provide the osx-sign option, ' +
'or manually sign the app later.')
}
if (osxSignOpt) {
const signOpts = createSignOpts(osxSignOpt, platform, this.renamedAppPath, version, this.opts.osxNotarize, this.opts.quiet)
debug(`Running electron-osx-sign with the options ${JSON.stringify(signOpts)}`)
try {
await signAsync(signOpts)
} catch (err) {
// Although not signed successfully, the application is packed.
common.warning(`Code sign failed; please retry manually. ${err}`)
}
}
}
}).then((res) => {
const app = path.join(res[0], `${pkg.productName}.app`)
console.log('flating...', app)
flat({ app }, function done (err) {
if (err) {
throw err
}
process.exit(0);
})
})
if (Array.isArray(buildDir)) {
buildDir = buildDir[0];
}
logger.log(`Built app in "${buildDir}".`);
if (macOSConfig.certNameInstaller) {
const appFile = path.join(buildDir, `${commonConfig.name}.app`);
await fs.ensureDir(commonConfig.distDir);
const pkgFile = path.join(commonConfig.distDir, `${commonConfig.name}.pkg`);
if (signManually) {
await manualMacOSSign(appFile, pkgFile, commonConfig, macOSConfig);
} else {
await buildPkg({
app: appFile,
identity: macOSConfig.certNameInstaller,
pkg: pkgFile,
platform: 'mas',
});
}
logger.log(`Built installer in "${commonConfig.distDir}".`);
}
} catch (error) {
logger.error(error);
}
await restoreFiles(backup);
}
}: MakerOptions) {
if (!['darwin', 'mas'].includes(targetPlatform)) {
throw new Error(`The pkg maker only supports targetting "mas" and "darwin" builds. You provided "${targetPlatform}"`);
}
const outPath = path.resolve(makeDir, `${appName}-${packageJSON.version}.pkg`);
await this.ensureFile(outPath);
const pkgConfig = {
...this.config,
app: path.resolve(dir, `${appName}.app`),
pkg: outPath,
platform: targetPlatform,
};
await flatAsync(pkgConfig);
return [outPath];
}
}
function parseIdentity(line) {
const firstQuoteIndex = line.indexOf('"');
const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('"'));
const hash = line.substring(0, firstQuoteIndex - 1);
return new _Identity(name, hash);
}