Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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];
}
}