Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions packages/flowtest-electron/electron-main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron');
const { app, BrowserWindow, Menu } = require('electron');
const path = require('path');
const url = require('url');
const template = require('./electron-menu');
const Watcher = require('./src/app/watcher');
const registerRendererEventHandlers = require('./src/ipc/collection');

let mainWindow;
let watcher;

function createWindow() {
app.on('ready', async () => {
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);

// Create the browser window.
mainWindow = new BrowserWindow({
width: 1280,
Expand Down Expand Up @@ -37,19 +41,6 @@ function createWindow() {
watcher = new Watcher();

registerRendererEventHandlers(mainWindow, watcher);
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow;

app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});

// Quit when all windows are closed, except on macOS. There, it's common
Expand All @@ -59,6 +50,3 @@ app.on('window-all-closed', function () {
//if (process.platform !== 'darwin')
app.quit();
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
59 changes: 59 additions & 0 deletions packages/flowtest-electron/electron-menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const { shell } = require('electron');

const template = [
{
label: 'FlowTestAI',
submenu: [
{ type: 'separator' },
{
role: 'quit',
label: 'Exit FlowTestAI',
},
],
},
{
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ type: 'separator' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'selectAll' },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideOthers' },
],
},
{
label: 'View',
submenu: [
{ role: 'toggledevtools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
{ role: 'togglefullscreen' },
],
},
{
role: 'window',
submenu: [{ role: 'minimize' }, { role: 'close', accelerator: 'CommandOrControl+Shift+Q' }],
},
{
role: 'help',
label: 'Help',
submenu: [
{
label: 'About',
click: async () => {
await shell.openExternal('https://github.com/FlowTestAI/FlowTest');
},
},
],
},
];

module.exports = template;
19 changes: 19 additions & 0 deletions packages/flowtest-electron/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require('dotenv').config();
const { notarize } = require('@electron/notarize');

exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return;
}

const appName = context.packager.appInfo.productFilename;

return await notarize({
appBundleId: 'com.flowtestai.app',
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.TEAM_ID,
});
};
46 changes: 41 additions & 5 deletions packages/flowtest-electron/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
{
"name": "flowtest-electron",
"name": "flowtestai",
"productName": "FlowTestAI",
"version": "1.0.0",
"homepage": ".",
"description": "",
"homepage": "https://github.com/FlowTestAI/FlowTest/tree/main",
"description": "OpenSource IDE for designing API powered flows",
"main": "electron-main.js",
"bugs": {
"url": "https://github.com/FlowTestAI/FlowTest/issues"
},
"scripts": {
"start": "electron .",
"test": "jest"
"test": "jest",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"author": "",
"author": "Sajal Jain <jsajal1993@gmail.com>",
"license": "MIT",
"devDependencies": {
"@electron/notarize": "^2.3.0",
"electron": "^29.0.0",
"electron-builder": "^24.13.3",
"jest": "^29.7.0"
},
"dependencies": {
Expand All @@ -27,5 +35,33 @@
"openai": "^4.29.1",
"path": "^0.12.7",
"uuid": "^9.0.1"
},
"build": {
"appId": "com.flowtestai.app",
"productName": "FlowTestAI",
"directories": {
"buildResources": "resources",
"output": "dist"
},
"files": [
"**/*"
],
"afterSign": "notarize.js",
"win": {
"target": "nsis"
},
"mac": {
"target": "dmg",
"category": "public.app-category.developer-tools",
"identity": "Sajal Jain (Z25C545DT5)",
"hardenedRuntime": true,
"gatekeeperAssess": false
},
"linux": {
"target": [
"AppImage",
"deb"
]
}
}
}