Initial upload for secondary development
This commit is contained in:
101
electron-launcher/electron-builder.config.cjs
Normal file
101
electron-launcher/electron-builder.config.cjs
Normal file
@@ -0,0 +1,101 @@
|
||||
const path = require('path');
|
||||
|
||||
function envText(name) {
|
||||
const value = process.env[name];
|
||||
if (value == null) return '';
|
||||
return String(value).trim();
|
||||
}
|
||||
|
||||
function envFlag(name) {
|
||||
return /^(1|true|yes|y|on)$/i.test(envText(name));
|
||||
}
|
||||
|
||||
const pfxFile = envText('CHATLAB_PFX_FILE');
|
||||
const pfxPassword = envText('CHATLAB_PFX_PASSWORD');
|
||||
const publisherName = envText('CHATLAB_CERT_PUBLISHER_NAME');
|
||||
const forceSigning = envFlag('CHATLAB_FORCE_SIGN');
|
||||
const timestampServer = envText('CHATLAB_TIMESTAMP_SERVER') || 'http://timestamp.digicert.com';
|
||||
const shouldSign = Boolean(pfxFile);
|
||||
const buildLabel = envText('CHATLAB_BUILD_LABEL')
|
||||
|| new Date().toISOString().replace(/[-:T]/g, '').slice(0, 12);
|
||||
|
||||
if (forceSigning && !shouldSign) {
|
||||
throw new Error('CHATLAB_FORCE_SIGN=1 requires CHATLAB_PFX_FILE to point to a .pfx/.p12 code signing certificate.');
|
||||
}
|
||||
|
||||
if (pfxPassword) {
|
||||
process.env.WIN_CSC_KEY_PASSWORD = pfxPassword;
|
||||
process.env.CSC_KEY_PASSWORD = pfxPassword;
|
||||
}
|
||||
|
||||
const win = {
|
||||
target: 'nsis',
|
||||
icon: 'build/icon.ico',
|
||||
artifactName: `ChatLab-Setup-\${version}-${buildLabel}.\${ext}`,
|
||||
signAndEditExecutable: shouldSign,
|
||||
forceCodeSigning: forceSigning,
|
||||
};
|
||||
|
||||
if (publisherName) {
|
||||
win.publisherName = publisherName;
|
||||
}
|
||||
|
||||
if (shouldSign) {
|
||||
win.signtoolOptions = {
|
||||
certificateFile: pfxFile,
|
||||
signingHashAlgorithms: ['sha256'],
|
||||
rfc3161TimeStampServer: timestampServer,
|
||||
};
|
||||
|
||||
if (publisherName) {
|
||||
win.signtoolOptions.publisherName = publisherName;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
appId: 'com.chatlab.desktop',
|
||||
productName: 'ChatLab售后智能助手',
|
||||
icon: 'build/icon.ico',
|
||||
directories: {
|
||||
output: 'dist',
|
||||
},
|
||||
files: [
|
||||
'main.js',
|
||||
'preload.js',
|
||||
'index.html',
|
||||
'build/company-logo.jpg',
|
||||
'build/icon.ico',
|
||||
'build/icon.png',
|
||||
'package.json',
|
||||
],
|
||||
extraResources: [
|
||||
{
|
||||
from: path.join(__dirname, 'build-resources'),
|
||||
to: '.',
|
||||
filter: [
|
||||
'**/*',
|
||||
'!**/.env',
|
||||
'!**/knowledge*.db',
|
||||
'!**/__pycache__/**',
|
||||
'!**/*.pfx',
|
||||
'!**/*.p12',
|
||||
'!**/*.pvk',
|
||||
'!**/*.cer',
|
||||
'!**/*.crt',
|
||||
'!**/*.key',
|
||||
'!**/certs/**',
|
||||
],
|
||||
},
|
||||
],
|
||||
win,
|
||||
nsis: {
|
||||
oneClick: false,
|
||||
installerIcon: 'build/icon.ico',
|
||||
uninstallerIcon: 'build/icon.ico',
|
||||
allowToChangeInstallationDirectory: true,
|
||||
perMachine: false,
|
||||
createDesktopShortcut: true,
|
||||
createStartMenuShortcut: true,
|
||||
shortcutName: 'ChatLab售后智能助手',
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user