NeahNew/electron/build-helpers.js
2025-05-06 22:43:27 +02:00

47 lines
1.4 KiB
JavaScript

// This file contains helper functions for Electron builds
const { writeFileSync, existsSync, mkdirSync } = require('fs');
const path = require('path');
/**
* Create a CSC_LINK placeholder file for macOS builds
* In a real production environment, you would use a real certificate
*/
function createDummyCertificateFile() {
const buildDir = path.join(__dirname, '../build');
// Create build directory if it doesn't exist
if (!existsSync(buildDir)) {
mkdirSync(buildDir, { recursive: true });
}
// Create a dummy cert file
const certPath = path.join(buildDir, 'dummy-cert.p12');
writeFileSync(certPath, 'DUMMY CERTIFICATE', 'utf8');
console.log(`Created dummy certificate at ${certPath}`);
return certPath;
}
/**
* Set up the environment for code signing
* This is a placeholder - in production, you'd use real certificates
*/
function setupCodeSigning() {
if (process.platform === 'darwin') {
console.log('Setting up macOS code signing');
const certPath = createDummyCertificateFile();
// In a real environment, you would have a real certificate and password
process.env.CSC_LINK = certPath;
process.env.CSC_KEY_PASSWORD = 'dummy-password';
console.log('Code signing environment variables set');
} else {
console.log(`Code signing setup not implemented for ${process.platform}`);
}
}
module.exports = {
setupCodeSigning
};