[PR #249] [CLOSED] Hecatron pull 1 #1118

Open
opened 2026-01-29 16:57:33 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ElectronNET/Electron.NET/pull/249
Author: @Hecatron
Created: 5/17/2019
Status: Closed

Base: masterHead: hecatron-pull-1


📝 Commits (10+)

  • 9dd920a Initial re-write of the configuration parsing
  • d63917f Initial re-write of the configuration parsing
  • 3925da1 fixes for the start and init commands after the first batch of testing
  • da8eda3 fixes added for add command after testing
  • 0ac6b00 additional fixes, and build is now in a working state
  • b5a47e4 final set of fixes
  • c5f6ba1 update to build scripts
  • 32b8c9a update to readme, minor update to build path
  • 8166f85 Fixes after rebase / bug fixes
  • be16413 removed build output option

📊 Changes

36 files changed (+2104 additions, -940 deletions)

View changed files

📝 ElectronNET.CLI/Commands/Actions/DeployEmbeddedElectronFiles.cs (+11 -12)
ElectronNET.CLI/Commands/Actions/DesiredPlatformInfo.cs (+123 -0)
📝 ElectronNET.CLI/Commands/Actions/DirectoryCopy.cs (+28 -32)
ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs (+0 -70)
📝 ElectronNET.CLI/Commands/AddCommand.cs (+98 -85)
📝 ElectronNET.CLI/Commands/BuildCommand.cs (+131 -148)
ElectronNET.CLI/Commands/CommandOption.cs (+0 -53)
ElectronNET.CLI/Commands/CommandType.cs (+68 -0)
📝 ElectronNET.CLI/Commands/InitCommand.cs (+116 -115)
ElectronNET.CLI/Commands/StartCommand.cs (+151 -0)
ElectronNET.CLI/Commands/StartElectronCommand.cs (+0 -108)
📝 ElectronNET.CLI/Commands/VersionCommand.cs (+40 -23)
ElectronNET.CLI/Config/AppSettings.cs (+122 -0)
ElectronNET.CLI/Config/CmdLineProvider/CallbackExtensions.cs (+27 -0)
ElectronNET.CLI/Config/CmdLineProvider/DirectCallbackProvider.cs (+36 -0)
ElectronNET.CLI/Config/CmdLineProvider/DirectCallbackSource.cs (+22 -0)
ElectronNET.CLI/Config/Commands/AddConfig.cs (+149 -0)
ElectronNET.CLI/Config/Commands/BuildConfig.cs (+244 -0)
ElectronNET.CLI/Config/Commands/ICommandConfig.cs (+17 -0)
ElectronNET.CLI/Config/Commands/InitConfig.cs (+102 -0)

...and 16 more files

📄 Description

Hi,
I've recently made an attempt at redoing the configuration for Electron.Net
I'd imagine this might not make it through as it's a large number of changes.
But i'd be interested in any feedback and I have tried testing all the different options / commands.

Configuration

I've set things up to use Microsoft.Extensions.Configuration
The way this works is that it first parses multiple sources into key value pairs
then binds those key value pairs to properties of a class.

  • First it attempts to load settings from a json file - "ElectronNetSettings.json" in the current directory

  • These can all be overriden by command line options such as "--npmcommand=npm" or "/npmcommand=npm"

  • The command line is split into arguments and switches, the switches can start with --, -, /
    so --npmcommand -npmcommand /npmcommand are all the same

  • It supports multiple arguments

  • Each command now has a seperate configuration class to store and parse it's settings.

  • I've tried to keep the command line options the same as before but with just additional options
    The one exception might be manually specifying the runtimeid / electronpacker settings in build
    The way that works is that it can auto detect the values, and then the user can just override the settings it pulls back with options if needed

Json file

For the configuration to give an example looking at the "start" command
it has a setting of builder["start:runtimeid"]
this can be set via "--runtimeid=" on the command line

for the json file it can be picked up via

{
  "start": {
    "runtimeid": "<value here>"
  }
}

Other changes

  • Some of the code in the commands has been split into seperate functions just to make it easier to read / follow
  • Help text is now nicely formatted
  • I've not tested it yet but I added a target for the 32bit rasberry pi
  • The build output I've set to be a subdirectory under bin (such as bin/Host for start, bin/desktop for build)
    Usually with C# projects everything built ends up in bin and it's likley the first place someone will look for a built project

I had to remove --production from the npm install during the build command.
A different solution would have been to move some of the devDependencies into dependencies within package.json
I suspect it's working for some users but not others with --production if they have some of the tools installed globaly at the right versions such as typescript

Anyway let me know what you think
Doing it this way might make it easier to add in other commands / options / arguments later on


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ElectronNET/Electron.NET/pull/249 **Author:** [@Hecatron](https://github.com/Hecatron) **Created:** 5/17/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `hecatron-pull-1` --- ### 📝 Commits (10+) - [`9dd920a`](https://github.com/ElectronNET/Electron.NET/commit/9dd920a65eeb6ee235a61799ca955a6c794bdf37) Initial re-write of the configuration parsing - [`d63917f`](https://github.com/ElectronNET/Electron.NET/commit/d63917f4ae564313b9943fd1ebfb523696b1c002) Initial re-write of the configuration parsing - [`3925da1`](https://github.com/ElectronNET/Electron.NET/commit/3925da1309a5152b37d151ce289c7d0f9e7f2807) fixes for the start and init commands after the first batch of testing - [`da8eda3`](https://github.com/ElectronNET/Electron.NET/commit/da8eda3f2449c3df197e7105c221481e5b58c11c) fixes added for add command after testing - [`0ac6b00`](https://github.com/ElectronNET/Electron.NET/commit/0ac6b00aa412ee6a42285f473e0bc17b89c7245f) additional fixes, and build is now in a working state - [`b5a47e4`](https://github.com/ElectronNET/Electron.NET/commit/b5a47e4d6115f36d7daf1dea4a64a5d24dd7daac) final set of fixes - [`c5f6ba1`](https://github.com/ElectronNET/Electron.NET/commit/c5f6ba129c18f5ad854945dea7fe98f5415a66ac) update to build scripts - [`32b8c9a`](https://github.com/ElectronNET/Electron.NET/commit/32b8c9a686613aa346747f191e5a26726259ca95) update to readme, minor update to build path - [`8166f85`](https://github.com/ElectronNET/Electron.NET/commit/8166f856429c03d75e212a3bf47950d0e7997802) Fixes after rebase / bug fixes - [`be16413`](https://github.com/ElectronNET/Electron.NET/commit/be16413f4e252bd763df8f3566131ff1dce3a68a) removed build output option ### 📊 Changes **36 files changed** (+2104 additions, -940 deletions) <details> <summary>View changed files</summary> 📝 `ElectronNET.CLI/Commands/Actions/DeployEmbeddedElectronFiles.cs` (+11 -12) ➕ `ElectronNET.CLI/Commands/Actions/DesiredPlatformInfo.cs` (+123 -0) 📝 `ElectronNET.CLI/Commands/Actions/DirectoryCopy.cs` (+28 -32) ➖ `ElectronNET.CLI/Commands/Actions/GetTargetPlatformInformation.cs` (+0 -70) 📝 `ElectronNET.CLI/Commands/AddCommand.cs` (+98 -85) 📝 `ElectronNET.CLI/Commands/BuildCommand.cs` (+131 -148) ➖ `ElectronNET.CLI/Commands/CommandOption.cs` (+0 -53) ➕ `ElectronNET.CLI/Commands/CommandType.cs` (+68 -0) 📝 `ElectronNET.CLI/Commands/InitCommand.cs` (+116 -115) ➕ `ElectronNET.CLI/Commands/StartCommand.cs` (+151 -0) ➖ `ElectronNET.CLI/Commands/StartElectronCommand.cs` (+0 -108) 📝 `ElectronNET.CLI/Commands/VersionCommand.cs` (+40 -23) ➕ `ElectronNET.CLI/Config/AppSettings.cs` (+122 -0) ➕ `ElectronNET.CLI/Config/CmdLineProvider/CallbackExtensions.cs` (+27 -0) ➕ `ElectronNET.CLI/Config/CmdLineProvider/DirectCallbackProvider.cs` (+36 -0) ➕ `ElectronNET.CLI/Config/CmdLineProvider/DirectCallbackSource.cs` (+22 -0) ➕ `ElectronNET.CLI/Config/Commands/AddConfig.cs` (+149 -0) ➕ `ElectronNET.CLI/Config/Commands/BuildConfig.cs` (+244 -0) ➕ `ElectronNET.CLI/Config/Commands/ICommandConfig.cs` (+17 -0) ➕ `ElectronNET.CLI/Config/Commands/InitConfig.cs` (+102 -0) _...and 16 more files_ </details> ### 📄 Description Hi, I've recently made an attempt at redoing the configuration for Electron.Net I'd imagine this might not make it through as it's a large number of changes. But i'd be interested in any feedback and I have tried testing all the different options / commands. ## Configuration I've set things up to use Microsoft.Extensions.Configuration The way this works is that it first parses multiple sources into key value pairs then binds those key value pairs to properties of a class. * First it attempts to load settings from a json file - "ElectronNetSettings.json" in the current directory * These can all be overriden by command line options such as "--npmcommand=npm" or "/npmcommand=npm" * The command line is split into arguments and switches, the switches can start with --, -, / so --npmcommand -npmcommand /npmcommand are all the same * It supports multiple arguments * Each command now has a seperate configuration class to store and parse it's settings. * I've tried to keep the command line options the same as before but with just additional options The one exception might be manually specifying the runtimeid / electronpacker settings in build The way that works is that it can auto detect the values, and then the user can just override the settings it pulls back with options if needed ## Json file For the configuration to give an example looking at the "start" command it has a setting of builder["start:runtimeid"] this can be set via "--runtimeid=<value>" on the command line for the json file it can be picked up via ``` { "start": { "runtimeid": "<value here>" } } ``` ## Other changes * Some of the code in the commands has been split into seperate functions just to make it easier to read / follow * Help text is now nicely formatted * I've not tested it yet but I added a target for the 32bit rasberry pi * The build output I've set to be a subdirectory under bin (such as bin/Host for start, bin/desktop for build) Usually with C# projects everything built ends up in bin and it's likley the first place someone will look for a built project I had to remove --production from the npm install during the build command. A different solution would have been to move some of the devDependencies into dependencies within package.json I suspect it's working for some users but not others with --production if they have some of the tools installed globaly at the right versions such as typescript Anyway let me know what you think Doing it this way might make it easier to add in other commands / options / arguments later on --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 16:57:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#1118