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/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index 682e07a..06b8b05 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) @@ -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..."); @@ -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; }); } 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..eb487c8 100644 --- a/ElectronNET.CLI/ElectronNET.CLI.csproj +++ b/ElectronNET.CLI/ElectronNET.CLI.csproj @@ -15,7 +15,10 @@ - + + + + @@ -25,7 +28,6 @@ - @@ -50,5 +52,7 @@ - + + + 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/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 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 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: diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..1387a76 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,10 @@ +version: 1.0.{build} +branches: + only: + - cli-etc +image: Visual Studio 2017 +build_script: +- cmd: buildAll.cmd +artifacts: +- path: ElectronNET.WebApp\bin\desktop + name: Desktop 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