Skip to content

Commit

Permalink
works on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
truemiller committed Jul 8, 2024
1 parent c9ca126 commit 739d976
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 deletions.
4 changes: 4 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* This script is used to build the electron app **with notarization**. It is used for the final build and release process.
*/
require('dotenv').config();
const build = require('electron-builder').build;

const { publishOptions } = require('./electron/constants');
Expand Down
52 changes: 52 additions & 0 deletions build.tester.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* This script is used to build the electron app **without** notarization.
*
* This is useful for testing the build process.
* It will not notarize the app, so it will not be able to be run on someone else's Mac without disabling Gatekeeper on their machine.
*/
require('dotenv').config();
const build = require('electron-builder').build;

const { publishOptions } = require('./electron/constants');

const main = async () => {
console.log('Building...');

/** @type import {CliOptions} from "electron-builder" */
await build({
publish: 'onTag',
config: {
appId: 'xyz.valory.olas-operate-app',
artifactName: '${productName}-${version}-${platform}-${arch}.${ext}',
productName: 'Pearl',
files: ['electron/**/*', 'package.json'],
directories: {
output: 'dist',
},
extraResources: [
{
from: 'electron/bins',
to: 'bins',
filter: ['**/*'],
},
],
mac: {
publish: null,
target: [
{
target: 'default',
arch: ['arm64'],
},
],
category: 'public.app-category.utilities',
icon: 'electron/assets/icons/splash-robot-head-dock.png',
hardenedRuntime: true,
gatekeeperAssess: false,
entitlements: 'electron/entitlements.mac.plist',
entitlementsInherit: 'electron/entitlements.mac.plist',
},
},
});
};

main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e));
5 changes: 3 additions & 2 deletions electron/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const os = require('os');
const path = require('path');
require('dotenv').config();

const PORT_RANGE = { startPort: 39152, endPort: 65535 };
const ERROR_ADDRESS_IN_USE = 'EADDRINUSE';
Expand All @@ -10,8 +11,8 @@ const isMac = process.platform === 'darwin';
const isLinux = process.platform === 'linux';

// Environment specific constants
const isProd = process.env.NODE_ENV === 'production';
const isDev = !isProd;
const isDev = process.env.NODE_ENV === 'development';
const isProd = !isDev;

// Paths
const dotOperateDirectory = isProd
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"productName": "Pearl",
"description": "An all-in-one application designed to streamline your entry into the world of autonomous agents and earning OLAS through staking.",
"scripts": {
"build": "rm -rf dist/ && electron-builder build",
"build": "rm -rf dist/ && node build.tester.js",
"build:frontend": "cd frontend && yarn build && rm -rf ../electron/.next && cp -r .next ../electron/.next && rm -rf ../electron/public && cp -r public ../electron/public",
"dev:backend": "poetry run python operate/cli.py",
"dev:frontend": "cd frontend && yarn dev",
Expand Down

0 comments on commit 739d976

Please sign in to comment.