Merge pull request #2075 from NAmorim/develop
Contribution - Application binaries (electron wrapped)
This commit is contained in:
5 files changed
+244
-13
No files matched your search
@@ -0,0 +1,33 @@
|
||||
# name of your github action
|
||||
name: CI
|
||||
# this will help you specify where to run
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
# this will run on the electron branch
|
||||
- develop
|
||||
# this is where the magic happens, each job happens in parallel btw
|
||||
jobs:
|
||||
build_on_mac:
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
ref: develop
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 16
|
||||
- name: see directory
|
||||
run: ls
|
||||
|
||||
build_on_win:
|
||||
runs-on: windows-2016
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
ref: develop
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 16
|
||||
- name: see directory
|
||||
run: ls
|
||||
@@ -19,3 +19,4 @@ node_modules
|
||||
launch.json
|
||||
package-lock.json
|
||||
.idea
|
||||
build
|
||||
+11
-9
@@ -1,18 +1,20 @@
|
||||
const path = require("path")
|
||||
|
||||
exports.newEnvironment = function () {
|
||||
|
||||
let thisObject = {
|
||||
WEB_SERVER_URL: 'localhost',
|
||||
CLIENT_WEB_SOCKETS_INTERFACE_PORT: 18041,
|
||||
CLIENT_HTTP_INTERFACE_PORT: 34248,
|
||||
PATH_TO_DATA_STORAGE: './Platform/My-Data-Storage',
|
||||
PATH_TO_LOG_FILES: './Platform/My-Log-Files',
|
||||
PATH_TO_PROJECTS: './Projects',
|
||||
PATH_TO_PROJECTS_REQUIRED: './Projects',
|
||||
PATH_TO_PROJECT_SCHEMA: './Projects/ProjectsSchema.json',
|
||||
PATH_TO_CLIENT: './Platform',
|
||||
PATH_TO_DEFAULT_WORKSPACE: './Projects/Foundations/Plugins/Workspaces',
|
||||
PATH_TO_MY_WORKSPACES: './Platform/My-Workspaces',
|
||||
PATH_TO_FONTS: './Platform/WebServer/Fonts'
|
||||
PATH_TO_DATA_STORAGE: path.join(__dirname, './Platform/My-Data-Storage'),
|
||||
PATH_TO_PROJECTS: path.join(__dirname, './Projects'),
|
||||
PATH_TO_LOG_FILES: path.join(__dirname, './Platform/My-Log-Files'),
|
||||
PATH_TO_PROJECTS_REQUIRED: path.join(__dirname, './Projects'),
|
||||
PATH_TO_PROJECT_SCHEMA: path.join(__dirname, './Projects/ProjectsSchema.json'),
|
||||
PATH_TO_CLIENT: path.join(__dirname, './Platform'),
|
||||
PATH_TO_DEFAULT_WORKSPACE: path.join(__dirname, './Projects/Foundations/Plugins/Workspaces'),
|
||||
PATH_TO_MY_WORKSPACES: path.join(__dirname, './Platform/My-Workspaces'),
|
||||
PATH_TO_FONTS: path.join(__dirname, './Platform/WebServer/Fonts')
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
const {app, Menu, BrowserWindow} = require('electron')
|
||||
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const WINDOW_WIDTH = null
|
||||
const WINDOW_HEIGHT = null
|
||||
|
||||
var w
|
||||
|
||||
var app_ready = false
|
||||
var server_ready = false
|
||||
|
||||
const port = 34248 // Default HTTP port
|
||||
|
||||
/* To check if the folders where user data do exist. If not, create them */
|
||||
function userData() {
|
||||
const dataStorage = path.join(process.cwd(), '/Platform/My-Data-Storage')
|
||||
const logFiles = path.join(process.cwd(), '/Platform/My-Log-Files')
|
||||
const workspace = path.join(process.cwd(), '/Platform/My-Workspaces')
|
||||
|
||||
if (!fs.existsSync(dataStorage)) {
|
||||
fs.mkdirSync(dataStorage)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(logFiles)) {
|
||||
fs.mkdirSync(logFiles)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(workspace)) {
|
||||
fs.mkdirSync(workspace)
|
||||
}
|
||||
}
|
||||
run()
|
||||
|
||||
function run() {
|
||||
userData()
|
||||
const { fork } = require('child_process')
|
||||
fork(path.join(__dirname, './PlatformRoot.js'), process.argv)
|
||||
|
||||
server_ready = true
|
||||
if (app_ready) open()
|
||||
}
|
||||
|
||||
function open () {
|
||||
let bw_options = {
|
||||
width: WINDOW_WIDTH ? WINDOW_WIDTH : 1280,
|
||||
height: WINDOW_HEIGHT ? WINDOW_HEIGHT : 720,
|
||||
resizable: true
|
||||
}
|
||||
|
||||
w = new BrowserWindow(
|
||||
bw_options
|
||||
)
|
||||
|
||||
w.setResizable(true)
|
||||
|
||||
w.loadURL("http://localhost:" + port)
|
||||
|
||||
// w.webContents.openDevTools()
|
||||
|
||||
w.on('closed', function () {
|
||||
w = null
|
||||
})
|
||||
}
|
||||
|
||||
app.on('ready', function () {
|
||||
app_ready = true
|
||||
create_menus()
|
||||
if (server_ready) open()
|
||||
})
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
app.quit()
|
||||
})
|
||||
|
||||
function create_menus () {
|
||||
const template = [
|
||||
{
|
||||
label: app.getName(),
|
||||
submenu: [
|
||||
{
|
||||
role: 'quit'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{role: 'undo'},
|
||||
{role: 'redo'},
|
||||
{type: 'separator'},
|
||||
{role: 'cut'},
|
||||
{role: 'copy'},
|
||||
{role: 'paste'},
|
||||
{role: 'pasteandmatchstyle'},
|
||||
{role: 'delete'},
|
||||
{role: 'selectall'}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Open in Browser...',
|
||||
click () {
|
||||
require('electron').shell.openExternal('http://localhost:' + port)
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{role: 'reload'},
|
||||
{role: 'forcereload'},
|
||||
{role: 'toggledevtools'},
|
||||
{type: 'separator'},
|
||||
{role: 'resetzoom'},
|
||||
{role: 'zoomin'},
|
||||
{role: 'zoomout'},
|
||||
{type: 'separator'},
|
||||
{role: 'togglefullscreen'}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const menu = Menu.buildFromTemplate(template)
|
||||
Menu.setApplicationMenu(menu)
|
||||
}
|
||||
+71
-4
@@ -1,13 +1,21 @@
|
||||
{
|
||||
"name": "superalgos",
|
||||
"version": "0.0.11",
|
||||
"description": "Superalgos",
|
||||
"version": "0.0.12-beta",
|
||||
"description": "Superalgos is a free, open-source crypto trading bot",
|
||||
"main": "electron-wrapper.js",
|
||||
"license": "Apache License 2.0",
|
||||
"homepage": "https://www.superalgos.org/",
|
||||
"author": {
|
||||
"name": "Luis-Fernando-Molina"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node platform minMemo noBrowser",
|
||||
"setup": "node setup noShortcuts"
|
||||
"start-dev": "node platform minMemo noBrowser",
|
||||
"setup": "node setup noShortcuts",
|
||||
"release-dev": "electron-builder --dir",
|
||||
"release-win": "electron-builder --win",
|
||||
"release-mac": "electron-builder --mac",
|
||||
"start": "electron . noBrowser",
|
||||
"postinstall": "electron-builder install-app-deps"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/rest": "^18.11.4",
|
||||
@@ -29,5 +37,64 @@
|
||||
"util": "^0.12.4",
|
||||
"web3": "^1.6.0",
|
||||
"ws": "^8.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^15.1.0",
|
||||
"electron-builder": "^22.11.7"
|
||||
},
|
||||
"build": {
|
||||
"appId": "org.superalgos.platform",
|
||||
"productName": "Superalgos",
|
||||
"directories": {
|
||||
"output": "build"
|
||||
},
|
||||
"files": [
|
||||
"**/*",
|
||||
"!.github${/*}",
|
||||
"!.vscode${/*}",
|
||||
"!.dockerignore${/*}",
|
||||
"!Data-Storage/*",
|
||||
"!Log-Files/*",
|
||||
"!My-Workspaces/*",
|
||||
"!build",
|
||||
"!Docker",
|
||||
"!Launch-Scripts",
|
||||
"!run.js",
|
||||
"!setup.js",
|
||||
"!uninstall.js"
|
||||
],
|
||||
"win": {
|
||||
"target": [
|
||||
{
|
||||
"target": "portable",
|
||||
"arch": "x64"
|
||||
},
|
||||
{
|
||||
"target": "nsis",
|
||||
"arch": "x64"
|
||||
}
|
||||
],
|
||||
"icon": "./Launch-Scripts/superalgos.ico",
|
||||
"publish": "github"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"perMachine": false,
|
||||
"allowElevation": false,
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"createDesktopShortcut": true,
|
||||
"createStartMenuShortcut": true,
|
||||
"license": "./LICENSE",
|
||||
"runAfterFinish": false
|
||||
},
|
||||
"mac": {
|
||||
"category": "public.app-category.finance",
|
||||
"target": "dmg",
|
||||
"type": "development",
|
||||
"publish": "github"
|
||||
},
|
||||
"linux": {
|
||||
"maintainer": "na.amorim@gmail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user