always invoke npm install

This commit is contained in:
Robert Muehsig
2019-01-15 22:21:25 +01:00
parent 71d2b88b02
commit f709f65f9e
3 changed files with 25 additions and 34 deletions

View File

@@ -68,6 +68,10 @@ namespace ElectronNET.CLI.Commands
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "package.json", "ElectronHostHook.");
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "tsconfig.json", "ElectronHostHook.");
// npm for typescript compiler etc.
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", targetFilePath);
// search .csproj
Console.WriteLine($"Search your .csproj to add configure CopyToPublishDirectory to 'Never'");
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly).FirstOrDefault();

View File

@@ -16,7 +16,7 @@ namespace ElectronNET.CLI.Commands
public static string COMMAND_ARGUMENTS = "Needed: '/target' with params 'win/osx/linux' to build for a typical app or use 'custom' and specify .NET Core build config & electron build config" + Environment.NewLine +
" for custom target, check .NET Core RID Catalog and Electron build target/" + Environment.NewLine +
" e.g. '/target win' or '/target custom \"win7-x86;win32\"'" + Environment.NewLine +
"Optional: '/dotnet-configuration' with the desired .NET Core build config e.g. release or debug. Default = Release" + Environment.NewLine +
"Optional: '/dotnet-configuration' with the desired .NET Core build config e.g. release or debug. Default = Release" + Environment.NewLine +
"Optional: '/electron-arch' to specify the resulting electron processor architecture (e.g. ia86 for x86 builds). Be aware to use the '/target custom' param as well!" + Environment.NewLine +
"Optional: '/electron-params' specify any other valid parameter, which will be routed to the electron-packager." + Environment.NewLine +
"Full example for a 32bit debug build with electron prune: build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params \"--prune=true \"";
@@ -86,32 +86,26 @@ namespace ElectronNET.CLI.Commands
DeployEmbeddedElectronFiles.Do(tempPath);
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
var nodeModulesDirPath = Path.Combine(tempPath, "node_modules");
if (Directory.Exists(checkForNodeModulesDirPath) == false)
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("Start npm install electron-packager...");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("Start npm install electron-packager...");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Works proper on Windows...
ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath);
}
else
{
// 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.");
}
// Works proper on Windows...
ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath);
}
else
{
Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath);
// 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("ElectronHostHook handling started...");

View File

@@ -61,19 +61,12 @@ namespace ElectronNET.CLI.Commands
DeployEmbeddedElectronFiles.Do(tempPath);
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
var nodeModulesDirPath = Path.Combine(tempPath, "node_modules");
if (Directory.Exists(checkForNodeModulesDirPath) == false)
{
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
Console.WriteLine("node_modules missing in: " + nodeModulesDirPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
}
else
{
Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath);
}
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("ElectronHostHook handling started...");
@@ -111,6 +104,6 @@ namespace ElectronNET.CLI.Commands
});
}
}
}