Add -npx flag for lime test electron to run the npx electron command instead of just electron.

This will prompt the user to install electron, if required. Saves a separate `npm install -g electron` command before testing.
This commit is contained in:
Josh Tynjala
2023-07-25 08:43:31 -07:00
parent 2cd1dad5ed
commit 6cff64018a
2 changed files with 9 additions and 3 deletions

View File

@@ -5,10 +5,15 @@ import lime.tools.HXProject;
class ElectronHelper
{
public static function launch(project:HXProject, path:String):Void
public static function launch(project:HXProject, path:String, ?npx:Bool):Void
{
var electronPath = project.defines.get("ELECTRON_PATH");
if (npx)
{
System.runCommand("", "npx", ["electron", path]);
return;
}
var electronPath = project.defines.get("ELECTRON_PATH");
if (electronPath == null || electronPath == "")
{
electronPath = "electron";

View File

@@ -263,7 +263,8 @@ class HTML5Platform extends PlatformTarget
}
else if (targetFlags.exists("electron"))
{
ElectronHelper.launch(project, targetDirectory + "/bin");
var npx = targetFlags.exists("npx");
ElectronHelper.launch(project, targetDirectory + "/bin", npx);
}
else
{