diff --git a/ElectronNET.CLI/Commands/BuildCommand.cs b/ElectronNET.CLI/Commands/BuildCommand.cs index e46e6ff..9da0d63 100644 --- a/ElectronNET.CLI/Commands/BuildCommand.cs +++ b/ElectronNET.CLI/Commands/BuildCommand.cs @@ -82,16 +82,7 @@ namespace ElectronNET.CLI.Commands return false; } - string electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook"); - if (Directory.Exists(electronhosthookDir)) - { - string hosthookDir = Path.Combine(tempPath, "ElectronHostHook"); - DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List() { "node_modules" }); - - Console.WriteLine("Start npm install for hosthooks..."); - ProcessHelper.CmdExecute("npm install", hosthookDir); - } DeployEmbeddedElectronFiles.Do(tempPath); @@ -123,6 +114,23 @@ namespace ElectronNET.CLI.Commands Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath); } + Console.WriteLine("ElectronHostHook handling started..."); + + string electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook"); + + if (Directory.Exists(electronhosthookDir)) + { + string hosthookDir = Path.Combine(tempPath, "ElectronHostHook"); + DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List() { "node_modules" }); + + Console.WriteLine("Start npm install for hosthooks..."); + ProcessHelper.CmdExecute("npm install", hosthookDir); + + string tscPath = Path.Combine(tempPath, "node_modules", ".bin"); + // ToDo: Not sure if this runs under linux/macos + ProcessHelper.CmdExecute(@"tsc -p ../../ElectronHostHook", tscPath); + } + Console.WriteLine("Build Electron Desktop Application..."); string buildPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "desktop"); diff --git a/ElectronNET.CLI/Commands/StartElectronCommand.cs b/ElectronNET.CLI/Commands/StartElectronCommand.cs index 1a352bc..93e8510 100644 --- a/ElectronNET.CLI/Commands/StartElectronCommand.cs +++ b/ElectronNET.CLI/Commands/StartElectronCommand.cs @@ -59,17 +59,6 @@ namespace ElectronNET.CLI.Commands return false; } - string electronhosthookDir = Path.Combine(aspCoreProjectPath, "ElectronHostHook"); - - if (Directory.Exists(electronhosthookDir)) - { - string hosthookDir = Path.Combine(tempPath, "ElectronHostHook"); - DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List() { "node_modules" }); - - Console.WriteLine("Start npm install for hosthooks..."); - ProcessHelper.CmdExecute("npm install", hosthookDir); - } - DeployEmbeddedElectronFiles.Do(tempPath); var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules"); @@ -86,8 +75,26 @@ namespace ElectronNET.CLI.Commands Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath); } + Console.WriteLine("ElectronHostHook handling started..."); + + string electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook"); + + if (Directory.Exists(electronhosthookDir)) + { + string hosthookDir = Path.Combine(tempPath, "ElectronHostHook"); + DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List() { "node_modules" }); + + Console.WriteLine("Start npm install for hosthooks..."); + ProcessHelper.CmdExecute("npm install", hosthookDir); + + string tscPath = Path.Combine(tempPath, "node_modules", ".bin"); + // ToDo: Not sure if this runs under linux/macos + ProcessHelper.CmdExecute(@"tsc -p ../../ElectronHostHook", tscPath); + } + string path = Path.Combine(tempPath, "node_modules", ".bin"); + bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); if (isWindows) {