From b5bdc8810914a53e4d4c48db9f48fb9c76ff49a9 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Sun, 15 Oct 2017 22:43:35 +0200 Subject: [PATCH 1/9] naming changes to electron.manifest.json --- ElectronNET.CLI/Commands/BuildCommand.cs | 6 +++--- ElectronNET.CLI/Commands/InitCommand.cs | 2 +- ElectronNET.CLI/Commands/StartElectronCommand.cs | 6 +++--- ElectronNET.CLI/ElectronNET.CLI.csproj | 6 ++++-- ElectronNET.CLI/EmbeddedFileHelper.cs | 8 +++++++- .../electron.manifest.json | 0 ElectronNET.Host/main.js | 2 +- ElectronNET.WebApp/ElectronNET.WebApp.csproj | 5 ++--- .../{electronnet.json => electron.manifest.json} | 0 9 files changed, 21 insertions(+), 14 deletions(-) rename ElectronNET.CLI/electronnet.json => ElectronNET.Host/electron.manifest.json (100%) rename ElectronNET.WebApp/{electronnet.json => electron.manifest.json} (100%) diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index 682e07a..650032d 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -51,9 +51,9 @@ namespace ElectronNET.CLI.Commands Directory.CreateDirectory(tempPath); } - EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js", "ElectronHost."); - EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json", "ElectronHost."); - EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package-lock.json", "ElectronHost."); + EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js"); + EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json"); + EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package-lock.json"); string hostApiFolder = Path.Combine(tempPath, "api"); if (Directory.Exists(hostApiFolder) == false) diff --git a/ElectronNET.CLI/Commands/InitCommand.cs b/ElectronNET.CLI/Commands/InitCommand.cs index 6cfbfe1..08fffb9 100644 --- a/ElectronNET.CLI/Commands/InitCommand.cs +++ b/ElectronNET.CLI/Commands/InitCommand.cs @@ -15,7 +15,7 @@ namespace ElectronNET.CLI.Commands public const string COMMAND_ARGUMENTS = " from ASP.NET Core Project."; public static IList CommandOptions { get; set; } = new List(); - private const string ConfigName = "electronnet.json"; + private const string ConfigName = "electron.manifest.json"; public Task ExecuteAsync() { diff --git a/ElectronNET.CLI/Commands/StartElectronCommand.cs b/ElectronNET.CLI/Commands/StartElectronCommand.cs index 1bf7231..474e1da 100644 --- a/ElectronNET.CLI/Commands/StartElectronCommand.cs +++ b/ElectronNET.CLI/Commands/StartElectronCommand.cs @@ -49,9 +49,9 @@ namespace ElectronNET.CLI.Commands string tempBinPath = Path.Combine(tempPath, "bin"); ProcessHelper.CmdExecute($"dotnet publish -r win10-x64 --output \"{tempBinPath}\"", aspCoreProjectPath); - EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js", "ElectronHost."); - EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json", "ElectronHost."); - EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package-lock.json", "ElectronHost."); + EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js"); + EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json"); + EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package-lock.json"); string hostApiFolder = Path.Combine(tempPath, "api"); if (Directory.Exists(hostApiFolder) == false) diff --git a/ElectronNET.CLI/ElectronNET.CLI.csproj b/ElectronNET.CLI/ElectronNET.CLI.csproj index ed3a5a0..8702f57 100644 --- a/ElectronNET.CLI/ElectronNET.CLI.csproj +++ b/ElectronNET.CLI/ElectronNET.CLI.csproj @@ -15,7 +15,10 @@ - + + + + @@ -25,7 +28,6 @@ - diff --git a/ElectronNET.CLI/EmbeddedFileHelper.cs b/ElectronNET.CLI/EmbeddedFileHelper.cs index aa405e3..9af2e1a 100644 --- a/ElectronNET.CLI/EmbeddedFileHelper.cs +++ b/ElectronNET.CLI/EmbeddedFileHelper.cs @@ -15,11 +15,17 @@ namespace ElectronNET.CLI return asm.GetManifestResourceStream(resource); } + public static void DeployEmbeddedFile(string targetPath, string file, string namespacePath = "") { using (var fileStream = File.Create(Path.Combine(targetPath, file))) { - var streamFromEmbeddedFile = GetTestResourceFileStream(namespacePath + file); + var streamFromEmbeddedFile = GetTestResourceFileStream("ElectronHost." + namespacePath + file); + if (streamFromEmbeddedFile == null) + { + Console.WriteLine("Error: Couldn't find embedded file: " + file); + } + streamFromEmbeddedFile.CopyTo(fileStream); } } diff --git a/ElectronNET.CLI/electronnet.json b/ElectronNET.Host/electron.manifest.json similarity index 100% rename from ElectronNET.CLI/electronnet.json rename to ElectronNET.Host/electron.manifest.json diff --git a/ElectronNET.Host/main.js b/ElectronNET.Host/main.js index b189e66..3437150 100644 --- a/ElectronNET.Host/main.js +++ b/ElectronNET.Host/main.js @@ -33,7 +33,7 @@ function startAspCoreBackend(electronPort) { loadURL = `http://localhost:${electronWebPort}` const parameters = [`/electronPort=${electronPort}`, `/electronWebPort=${electronWebPort}`]; - const manifestFile = require("./bin/electronnet.json"); + const manifestFile = require("./bin/electron.manifest.json"); let binaryFile = manifestFile.executable; const os = require("os"); diff --git a/ElectronNET.WebApp/ElectronNET.WebApp.csproj b/ElectronNET.WebApp/ElectronNET.WebApp.csproj index a1ae41d..a3bbb00 100644 --- a/ElectronNET.WebApp/ElectronNET.WebApp.csproj +++ b/ElectronNET.WebApp/ElectronNET.WebApp.csproj @@ -22,7 +22,6 @@ - PreserveNewest @@ -32,8 +31,8 @@ - + PreserveNewest - + \ No newline at end of file diff --git a/ElectronNET.WebApp/electronnet.json b/ElectronNET.WebApp/electron.manifest.json similarity index 100% rename from ElectronNET.WebApp/electronnet.json rename to ElectronNET.WebApp/electron.manifest.json From 4ed51e5fa8791d67b385547dbcd4d968fb0ad4d9 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Mon, 16 Oct 2017 22:27:54 +0200 Subject: [PATCH 2/9] for xplat dev: always remove dlls from cache --- ElectronNET.API/ElectronNET.API.csproj | 4 +++- ElectronNET.API/devCleanup.sh | 1 + ElectronNET.CLI/ElectronNET.CLI.csproj | 4 +++- ElectronNET.CLI/devCleanup.sh | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100755 ElectronNET.API/devCleanup.sh create mode 100755 ElectronNET.CLI/devCleanup.sh diff --git a/ElectronNET.API/ElectronNET.API.csproj b/ElectronNET.API/ElectronNET.API.csproj index 04863a3..0dfc108 100644 --- a/ElectronNET.API/ElectronNET.API.csproj +++ b/ElectronNET.API/ElectronNET.API.csproj @@ -15,6 +15,8 @@ - + + + diff --git a/ElectronNET.API/devCleanup.sh b/ElectronNET.API/devCleanup.sh new file mode 100755 index 0000000..f3b1b44 --- /dev/null +++ b/ElectronNET.API/devCleanup.sh @@ -0,0 +1 @@ +rm -rf ~/.nuget/packages/electronnet.api \ No newline at end of file diff --git a/ElectronNET.CLI/ElectronNET.CLI.csproj b/ElectronNET.CLI/ElectronNET.CLI.csproj index 8702f57..eb487c8 100644 --- a/ElectronNET.CLI/ElectronNET.CLI.csproj +++ b/ElectronNET.CLI/ElectronNET.CLI.csproj @@ -52,5 +52,7 @@ - + + + diff --git a/ElectronNET.CLI/devCleanup.sh b/ElectronNET.CLI/devCleanup.sh new file mode 100755 index 0000000..b8b7e1f --- /dev/null +++ b/ElectronNET.CLI/devCleanup.sh @@ -0,0 +1 @@ +rm -rf ~/.nuget/packages/electronnet.cli \ No newline at end of file From d3b997b27487a69d61c93c4eda592282dce86173 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Mon, 16 Oct 2017 22:36:46 +0200 Subject: [PATCH 3/9] buildAll.cmd --- buildAll.cmd | 17 +++++++++++++++++ buildAll.sh | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 buildAll.cmd create mode 100755 buildAll.sh diff --git a/buildAll.cmd b/buildAll.cmd new file mode 100755 index 0000000..68e41e1 --- /dev/null +++ b/buildAll.cmd @@ -0,0 +1,17 @@ +echo "Start building Electron.NET dev stack..." +echo "Restore & Build API" +cd ElectronNet.API +dotnet restore +dotnet build +cd .. +echo "Restore & Build API" +cd ElectronNet.CLI +dotnet restore +dotnet build +cd .. +echo "Restore & Build WebApp Demo" +cd ElectronNet.WebApp +dotnet restore +dotnet build +echo "Invoke electronize build in WebApp Demo" +dotnet electronize build \ No newline at end of file diff --git a/buildAll.sh b/buildAll.sh new file mode 100755 index 0000000..68e41e1 --- /dev/null +++ b/buildAll.sh @@ -0,0 +1,17 @@ +echo "Start building Electron.NET dev stack..." +echo "Restore & Build API" +cd ElectronNet.API +dotnet restore +dotnet build +cd .. +echo "Restore & Build API" +cd ElectronNet.CLI +dotnet restore +dotnet build +cd .. +echo "Restore & Build WebApp Demo" +cd ElectronNet.WebApp +dotnet restore +dotnet build +echo "Invoke electronize build in WebApp Demo" +dotnet electronize build \ No newline at end of file From 92dd55050d94d460859ff3d2b3713cc4b8d9bbe7 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Mon, 16 Oct 2017 22:43:38 +0200 Subject: [PATCH 4/9] Create appveyor.yml --- appveyor.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..41ba02b --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,16 @@ +# Test against the latest version of this Node.js version +environment: + nodejs_version: "6" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node.js or io.js + - ps: Install-Product node $env:nodejs_version + # install modules + - npm install + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version From 65f250455d5094629fe118ec6799d08c42017d09 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Sun, 15 Oct 2017 23:15:42 +0200 Subject: [PATCH 5/9] typo --- ElectronNET.CLI/Commands/BuildCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index 650032d..f556d8f 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -82,7 +82,7 @@ namespace ElectronNET.CLI.Commands { // ToDo: find another solution or document it proper // GH Issue https://github.com/electron-userland/electron-prebuilt/issues/48 - Console.WriteLine("Electron Packager - make sure you invoke 'sudo npm install electron - packager--global' at " + tempPath + " manually. Sry."); + Console.WriteLine("Electron Packager - make sure you invoke 'sudo npm install electron-packager --global' at " + tempPath + " manually. Sry."); } Console.WriteLine("Build Electron Desktop Application..."); From b6d4e0d36c5ee2e9e1548b1f55df3f80d0f4999f Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Mon, 16 Oct 2017 22:57:43 +0200 Subject: [PATCH 6/9] Update appveyor.yml --- appveyor.yml | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 41ba02b..dbda243 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,16 +1,7 @@ -# Test against the latest version of this Node.js version -environment: - nodejs_version: "6" - -# Install scripts. (runs after repo cloning) -install: - # Get the latest stable version of Node.js or io.js - - ps: Install-Product node $env:nodejs_version - # install modules - - npm install - -# Post-install test scripts. -test_script: - # Output useful info for debugging. - - node --version - - npm --version +version: 1.0.{build} +branches: + only: + - cli-etc +image: Visual Studio 2017 +build_script: +- cmd: buildAll.cmd From 56652e92574f14c779e1df348313d02b4e237449 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Mon, 16 Oct 2017 22:58:52 +0200 Subject: [PATCH 7/9] done note --- ElectronNET.CLI/Commands/BuildCommand.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index f556d8f..06b8b05 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -96,8 +96,8 @@ namespace ElectronNET.CLI.Commands ProcessHelper.CmdExecute($"electron-packager . --platform=win32 --arch=x64 --out=\"{buildPath}\" --overwrite", tempPath); } - - if(RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Console.WriteLine("Package Electron App for OSX..."); @@ -111,6 +111,8 @@ namespace ElectronNET.CLI.Commands ProcessHelper.CmdExecute($"electron-packager . --platform=linux --arch=x64 --out=\"{buildPath}\" --overwrite", tempPath); } + Console.WriteLine("... done"); + return true; }); } From ce34b8ca9836375f2d90f59643b46852bde539cd Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Mon, 16 Oct 2017 23:07:14 +0200 Subject: [PATCH 8/9] Update appveyor.yml --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index dbda243..1387a76 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,3 +5,6 @@ branches: image: Visual Studio 2017 build_script: - cmd: buildAll.cmd +artifacts: +- path: ElectronNET.WebApp\bin\desktop + name: Desktop From 677f355155c69ad2fa876eb2d9d69c1a2d93fe09 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Mon, 16 Oct 2017 23:16:50 +0200 Subject: [PATCH 9/9] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e351a88..c4fae30 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Electron.NET +# Electron.NET [![Build status](https://ci.appveyor.com/api/projects/status/u710d6hman5a4beb/branch/cli-etc?svg=true)](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/cli-etc) + Build cross platform desktop apps with .NET Core and ASP.NET NET Core. ## Dev Notes: