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: [
|
|
|
|
'../ollama',
|
2023-07-18 17:33:04 +00:00
|
|
|
path.join(__dirname, './assets/ollama_icon_16x16Template.png'),
|
|
|
|
path.join(__dirname, './assets/ollama_icon_16x16Template@2x.png'),
|
2023-07-19 15:13:49 +00:00
|
|
|
path.join(__dirname, './assets/ollama_outline_icon_16x16Template.png'),
|
|
|
|
path.join(__dirname, './assets/ollama_outline_icon_16x16Template@2x.png'),
|
2023-07-11 23:36:37 +00:00
|
|
|
...(process.platform === 'darwin' ? ['../llama/ggml-metal.metal'] : []),
|
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-06-23 19:04:38 +00:00
|
|
|
},
|
|
|
|
rebuildConfig: {},
|
2023-07-06 16:45:58 +00:00
|
|
|
makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin'])],
|
2023-06-27 18:33:49 +00:00
|
|
|
publishers: [
|
|
|
|
new PublisherGithub({
|
|
|
|
repository: {
|
|
|
|
name: 'ollama',
|
|
|
|
owner: 'jmorganca',
|
|
|
|
},
|
|
|
|
draft: false,
|
|
|
|
prerelease: true,
|
|
|
|
}),
|
|
|
|
],
|
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
|