Print http-server message, allow auto port finding starting at 3000
This commit is contained in:
@@ -85,7 +85,7 @@ class HTML5Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function launch(project:HXProject, path:String, port:Int = 3000):Void
|
public static function launch(project:HXProject, path:String, port:Int = 0):Void
|
||||||
{
|
{
|
||||||
if (project.app.url != null && project.app.url != "")
|
if (project.app.url != null && project.app.url != "")
|
||||||
{
|
{
|
||||||
@@ -124,27 +124,25 @@ class HTML5Helper
|
|||||||
Sys.command("chmod", ["+x", node]);
|
Sys.command("chmod", ["+x", node]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var args = [server, path, "-c-1", "--cors"];
|
||||||
|
|
||||||
if (project.targetFlags.exists("port"))
|
if (project.targetFlags.exists("port"))
|
||||||
{
|
{
|
||||||
port = Std.parseInt(project.targetFlags.get("port"));
|
port = Std.parseInt(project.targetFlags.get("port"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info("", " - \x1b[1mStarting local web server:\x1b[0m http://localhost:" + port);
|
if (port != 0)
|
||||||
|
|
||||||
/*Thread.create (function () {
|
|
||||||
|
|
||||||
Sys.sleep (0.5);
|
|
||||||
System.openURL ("http://localhost:" + port);
|
|
||||||
|
|
||||||
});*/
|
|
||||||
|
|
||||||
var args = ["--no-deprecation", server, path, "-p", Std.string(port), "-c-1", "--cors"];
|
|
||||||
|
|
||||||
if (project.targetFlags.exists("nolaunch"))
|
|
||||||
{
|
{
|
||||||
Log.info("\x1b[1mStarting local web server:\x1b[0m http://localhost:" + port);
|
args.push("-p");
|
||||||
|
args.push(Std.string(port));
|
||||||
|
Log.info("", "\x1b[1mStarting local web server:\x1b[0m http://localhost:" + port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
Log.info("", "\x1b[1mStarting local web server:\x1b[0m http://localhost:[3000*]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!project.targetFlags.exists("nolaunch"))
|
||||||
{
|
{
|
||||||
args.push("-o");
|
args.push("-o");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,13 +120,20 @@ else if (chalk) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CHANGE: Always show logger info
|
||||||
|
if (!logger) logger = {};
|
||||||
|
logger.info = console.log;
|
||||||
|
// END CHANGE
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
logger.info('v' + require('../package.json').version);
|
logger.info('v' + require('../package.json').version);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!port) {
|
if (!port) {
|
||||||
portfinder.basePort = 8080;
|
// CHANGE: Start finding ports beginning at port 3000
|
||||||
|
portfinder.basePort = 3000;
|
||||||
|
// END CHANGE
|
||||||
portfinder.getPort(function (err, port) {
|
portfinder.getPort(function (err, port) {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
listen(port);
|
listen(port);
|
||||||
|
|||||||
Reference in New Issue
Block a user