Skip to content

Commit

Permalink
Remove bundled Node.js executable
Browse files Browse the repository at this point in the history
Commands that still require Node.js will attempt to use the system version on the PATH instead
  • Loading branch information
joshtynjala committed Mar 3, 2025
1 parent c3335e1 commit 7dc7ea3
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 102 deletions.
67 changes: 4 additions & 63 deletions src/lime/tools/HTML5Helper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -93,45 +93,11 @@ class HTML5Helper
}
else
{
var suffix = switch (System.hostPlatform)
{
case WINDOWS: "-windows.exe";
case MAC: "-mac";
case LINUX: "-linux";
default: return;
}

if (suffix == "-linux")
{
if (System.hostArchitecture == X86)
{
suffix += "32";
}
else if( System.hostArchitecture == ARMV7)
{
suffix += "Arm";
}
else if( System.hostArchitecture == ARM64)
{
suffix += "Arm64";
}
else
{
suffix += "64";
}
}

var templatePaths = [
Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end)
].concat(project.templatePaths);
var node = System.findTemplate(templatePaths, "bin/node/node" + suffix);
var server = System.findTemplate(templatePaths, "bin/node/http-server/bin/http-server");

if (System.hostPlatform != WINDOWS)
{
Sys.command("chmod", ["+x", node]);
}

var args = [server, path, "-c-1", "--cors"];

if (project.targetFlags.exists("port"))
Expand Down Expand Up @@ -160,7 +126,7 @@ class HTML5Helper
args.push("--silent");
}

System.runCommand("", node, args);
System.runCommand("", "node", args);
}
}

Expand All @@ -174,37 +140,12 @@ class HTML5Helper
{
var executable = "npx";
var terser = "terser";
if (!project.targetFlags.exists("npx")) {
var suffix = switch (System.hostPlatform)
{
case WINDOWS: "-windows.exe";
case MAC: "-mac";
case LINUX: "-linux";
default: return false;
}

if (suffix == "-linux")
{
if (System.hostArchitecture == X86)
{
suffix += "32";
}
else
{
suffix += "64";
}
}

if (!project.targetFlags.exists("npx"))
{
var templatePaths = [
Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end)
].concat(project.templatePaths);
executable = System.findTemplate(templatePaths, "bin/node/node" + suffix);
terser = System.findTemplate(templatePaths, "bin/node/terser/bin/terser");

if (System.hostPlatform != WINDOWS)
{
Sys.command("chmod", ["+x", executable]);
}
}

var args = [
Expand All @@ -222,7 +163,7 @@ class HTML5Helper
args.push('content=\'${sourceFile}.map\'');
}

System.runCommand("", executable, args);
System.runCommand("", "node", args);
}
else if (project.targetFlags.exists("yui"))
{
Expand Down
39 changes: 0 additions & 39 deletions src/lime/tools/NodeJSHelper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,7 @@ class NodeJSHelper
{
public static function run(project:HXProject, modulePath:String, args:Array<String> = null):Void
{
/*var suffix = switch (System.hostPlatform) {
case Platform.WINDOWS: "-windows.exe";
case Platform.MAC: "-mac";
case Platform.LINUX: "-linux";
default: return;
}
if (suffix == "-linux") {
if (System.hostArchitecture == X86) {
suffix += "32";
} else {
suffix += "64";
}
}
var templatePaths = [ Path.combine (Haxelib.getPath (new Haxelib (#if lime "lime" #else "hxp" #end)), "templates") ].concat (project.templatePaths);
var node = System.findTemplate (templatePaths, "bin/node/node" + suffix);
if (System.hostPlatform != WINDOWS) {
Sys.command ("chmod", [ "+x", node ]);
}
if (args == null) {
args = [];
}*/

args.unshift(Path.withoutDirectory(modulePath));

System.runCommand(Path.directory(modulePath), "node", args);
}
}
Binary file removed templates/bin/node/node-linux64
Binary file not shown.
Binary file removed templates/bin/node/node-mac
Binary file not shown.
Binary file removed templates/bin/node/node-windows.exe
Binary file not shown.

0 comments on commit 7dc7ea3

Please sign in to comment.