-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
46 lines (43 loc) · 1.46 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const { app, BrowserWindow, nativeImage } = require('electron');
const path = require('path');
const { execFile, exec } = require('child_process');
const { error } = require('console');
const fs = require('fs');
const isDevelopment = process.env.NODE_ENV === 'development';
function createWindow() {
const iconPath = path.join(__dirname, 'assets', 'appIcon.icns'); // Adjust the path as needed
const appIcon = nativeImage.createFromPath(iconPath);
const win = new BrowserWindow({
icon: appIcon,
autoHideMenuBar: true,
center: true,
minHeight: 1000,
minWidth: 1500,
title: 'Mattermost Bootstrapper Utility',
});
if (isDevelopment) {
win.loadURL('http://localhost:3000'); // Assuming React dev server
} else {
const indexPath = path.join(app.getAppPath(), 'webapp', 'build', 'index.html');
console.log(indexPath);
win.loadFile(indexPath);
}
}
app.whenReady().then(() => {
createWindow();
if (isDevelopment) {
exec('/Users/nickmisasi/go/bin/mcnb server')
} else {
execFile(path.join(__dirname, 'build', 'mmbs-mac_arm64'), (error, stdout, stderr) => {
if (error) {
console.error(`Error: ${error.message}`);
return;
}
if (stderr) {
console.error(`Error: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
});
}
});