Add proper Electron launcher and building process #6
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -9,3 +9,4 @@ log-journal.json | |||||||
| openCountdown | openCountdown | ||||||
| openCountdown.exe | openCountdown.exe | ||||||
| buildout | buildout | ||||||
|  | package-lock.json | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								README.MD
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.MD
									
									
									
									
									
								
							| @@ -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.* | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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) { | ||||||
|   | |||||||
							
								
								
									
										4071
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4071
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										30
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								package.json
									
									
									
									
									
								
							| @@ -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" | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|        |  | ||||||
| @@ -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() | ||||||
|     } |     } | ||||||
		Reference in New Issue
	
	Block a user