2023-07-18 14:41:36 +00:00
|
|
|
import type { ForgeConfig } from '@electron-forge/shared-types'
|
2023-06-23 19:04:38 +00:00
|
|
|
import { MakerSquirrel } from '@electron-forge/maker-squirrel'
|
|
|
|
import { MakerZIP } from '@electron-forge/maker-zip'
|
2023-06-27 18:33:49 +00:00
|
|
|
import { PublisherGithub } from '@electron-forge/publisher-github'
|
2023-06-23 19:04:38 +00:00
|
|
|
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives'
|
|
|
|
import { WebpackPlugin } from '@electron-forge/plugin-webpack'
|
2023-07-06 17:56:05 +00:00
|
|
|
import * as path from 'path'
|
|
|
|
import * as fs from 'fs'
|
2023-06-23 19:04:38 +00:00
|
|
|
|
|
|
|
import { mainConfig } from './webpack.main.config'
|
|
|
|
import { rendererConfig } from './webpack.renderer.config'
|
|
|
|
|
2023-07-06 17:56:05 +00:00
|
|
|
const packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './package.json'), 'utf8'))
|
|
|
|
|
2023-06-23 19:04:38 +00:00
|
|
|
const config: ForgeConfig = {
|
|
|
|
packagerConfig: {
|
2023-07-06 17:56:05 +00:00
|
|
|
appVersion: process.env.VERSION || packageJson.version,
|
2023-06-23 19:04:38 +00:00
|
|
|
asar: true,
|
2023-07-06 18:11:26 +00:00
|
|
|
icon: './assets/icon.icns',
|
2023-07-06 16:45:58 +00:00
|
|
|
extraResource: [
|
2023-07-28 16:18:11 +00:00
|
|
|
'../dist/ollama',
|
2023-07-26 18:04:36 +00:00
|
|
|
path.join(__dirname, './assets/iconTemplate.png'),
|
|
|
|
path.join(__dirname, './assets/iconTemplate@2x.png'),
|
|
|
|
path.join(__dirname, './assets/iconUpdateTemplate.png'),
|
|
|
|
path.join(__dirname, './assets/iconUpdateTemplate@2x.png'),
|
2023-07-27 20:25:36 +00:00
|
|
|
path.join(__dirname, './assets/iconDarkTemplate.png'),
|
|
|
|
path.join(__dirname, './assets/iconDarkTemplate@2x.png'),
|
|
|
|
path.join(__dirname, './assets/iconDarkUpdateTemplate.png'),
|
|
|
|
path.join(__dirname, './assets/iconDarkUpdateTemplate@2x.png'),
|
2023-07-06 16:45:58 +00:00
|
|
|
],
|
2023-06-27 18:33:49 +00:00
|
|
|
...(process.env.SIGN
|
|
|
|
? {
|
|
|
|
osxSign: {
|
|
|
|
identity: process.env.APPLE_IDENTITY,
|
|
|
|
},
|
|
|
|
osxNotarize: {
|
|
|
|
tool: 'notarytool',
|
|
|
|
appleId: process.env.APPLE_ID || '',
|
|
|
|
appleIdPassword: process.env.APPLE_PASSWORD || '',
|
|
|
|
teamId: process.env.APPLE_TEAM_ID || '',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
: {}),
|
2023-07-28 16:18:11 +00:00
|
|
|
osxUniversal: {
|
|
|
|
x64ArchFiles: '**/ollama',
|
|
|
|
},
|
2023-06-23 19:04:38 +00:00
|
|
|
},
|
|
|
|
rebuildConfig: {},
|
2023-07-06 16:45:58 +00:00
|
|
|
makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin'])],
|
2023-07-07 15:41:53 +00:00
|
|
|
hooks: {
|
|
|
|
readPackageJson: async (_, packageJson) => {
|
|
|
|
return { ...packageJson, version: process.env.VERSION || packageJson.version }
|
|
|
|
},
|
|
|
|
},
|
2023-06-23 19:04:38 +00:00
|
|
|
plugins: [
|
|
|
|
new AutoUnpackNativesPlugin({}),
|
|
|
|
new WebpackPlugin({
|
|
|
|
mainConfig,
|
2023-07-14 23:34:24 +00:00
|
|
|
devContentSecurityPolicy: `default-src * 'unsafe-eval' 'unsafe-inline'; img-src data: 'self'`,
|
2023-06-23 19:04:38 +00:00
|
|
|
renderer: {
|
|
|
|
config: rendererConfig,
|
2023-06-27 16:35:51 +00:00
|
|
|
nodeIntegration: true,
|
2023-06-23 19:04:38 +00:00
|
|
|
entryPoints: [
|
|
|
|
{
|
|
|
|
html: './src/index.html',
|
|
|
|
js: './src/renderer.tsx',
|
|
|
|
name: 'main_window',
|
|
|
|
preload: {
|
|
|
|
js: './src/preload.ts',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
export default config
|