Add proper Electron launcher and building process #6

Merged
grey merged 6 commits from electron into master 2022-11-15 18:28:59 +01:00
7 changed files with 3844 additions and 302 deletions
Showing only changes of commit 811d96f5fa - Show all commits

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ log-journal.json
openCountdown openCountdown
openCountdown.exe openCountdown.exe
buildout buildout
package-lock.json

View File

@ -10,19 +10,19 @@ Support for companion is currently being worked on [here](https://github.com/bit
You can download complete binaries from the release tab. You can download complete binaries from the release tab.
## Development build ## Development build
1. Download the repository 1. Download the repository
2. `npm install` to install dependecies 2. `npm install` to install dependencies
3. `npm start` to launch 3. `npm start` to launch
### Startup Arguments ### Startup Arguments
One can pass a `--headless` argument to start the server in headless mode. This will disable the GUI. One can pass a `--headless` argument to start the server in headless mode. This will disable the GUI.
## Packaging ## Packaging
This is more a comment for the future version of me. There is one command for packaging using nexe. We've introduced a new packaging system. It is based on [electron-builder](https://www.electron.build/). This allows for easy packaging of the application for different platforms.
```bash ```bash
npx nexe index.js --build --python python3 --resource "./{lang,templates,static}/**/*" --ouput "openCountdown.exe” chmod +x ./build.sh
./build.sh
``` ```
Where `--python` is only needed in some envoirments for some reason. Also adjust `--output` for your target OS.
> Binary Builds may be faulty or non-working. They are not offically supported. > Binary Builds may be faulty or non-working. They are not officially supported.
*Small disclaimer: Please do not use openCountdown for military or life-depending applications. Please also refrain from using openCountdown for launching rockets.* *Small disclaimer: Please do not use openCountdown for military or life-depending applications. Please also refrain from using openCountdown for launching rockets.*

View File

@ -25,7 +25,7 @@ function close(){
/** /**
* A simple logging function * A simple logging function
* @param {String} message A messaged to be logged * @param {String} message A messaged to be logged
* @param {String} level Logleve, may either be warn, error, magic or info * @param {String} level Loglevel, may either be warn, error, magic or info
* @param {String} module Kinda the source * @param {String} module Kinda the source
*/ */
function log(message, level, module, ignore = false) { function log(message, level, module, ignore = false) {
@ -58,4 +58,4 @@ function log(message, level, module, ignore = false) {
} }
} }
module.exports = { log, init, close}; module.exports = { log, init, close };

4071
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,38 +2,38 @@
"name": "opencountdown", "name": "opencountdown",
"version": "1.0.4", "version": "1.0.4",
"description": "An opensource countdown", "description": "An opensource countdown",
"main": "newStartHandler.js", "main": "startHandler.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"start": "electron newStartHandler.js" "start": "electron startHandler.js"
}, },
"author": "TheGreydiamond", "author": "TheGreydiamond",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"dependencies": { "dependencies": {
"body-parser": "^1.19.2", "body-parser": "^1.20.1",
"bootstrap": "^5.1.3", "bootstrap": "^5.2.2",
"bootstrap-duration-picker": "^2.1.3", "bootstrap-duration-picker": "^2.1.3",
"bootstrap-icons": "^1.8.1", "bootstrap-icons": "^1.10.1",
"colors": "^1.4.0", "colors": "^1.4.0",
"darkreader": "^4.9.44", "darkreader": "^4.9.58",
"eta": "^1.12.3", "eta": "^1.12.3",
"express": "^4.17.3", "express": "^4.18.2",
"flatpickr": "^4.6.11", "flatpickr": "^4.6.13",
"jquery": "^3.6.0", "jquery": "^3.6.1",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
"less": "^3.13", "less": "^4.1.3",
"mdbootstrap": "^4.20.0", "mdbootstrap": "^4.20.0",
"open": "^8.4.0", "open": "^8.4.0",
"underscore": "^1.13.3", "underscore": "^1.13.6",
"ws": "^8.5.0" "ws": "^8.11.0"
}, },
"devDependencies": { "devDependencies": {
"electron": "^20.0.3" "electron": "^21.2.3",
"electron-builder": "^23.6.0"
}, },
"build": { "build": {
"extraMetadata": { "extraMetadata": {
"main": "newStartHandler.js" "main": "startHandler.js"
} }
} }
} }

View File

@ -88,7 +88,7 @@ const createWindow = () => {
win.loadFile('electronAssets/index2.html') win.loadFile('electronAssets/index.html')
if (configObject.startMinimised) { if (configObject.startMinimised) {
win.hide() win.hide()
} }