From a9ec0864e0c740a52cee76ac4a6f0b7cf52a64f3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 21 Oct 2015 20:58:24 -0500 Subject: [PATCH 1/3] Refactored CLI script to allow port 0 --- bin/harp | 25 +++++++++++-------------- lib/index.js | 2 ++ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/bin/harp b/bin/harp index 7b629dfb..87a502b6 100755 --- a/bin/harp +++ b/bin/harp @@ -82,16 +82,12 @@ program .description("Start a Harp server in current directory") .action(function(path, program){ var projectPath = nodePath.resolve(process.cwd(), path || "") - var ip = program.ip || '0.0.0.0' - var port = program.port || 9000 - harp.server(projectPath, { ip: ip, port: port }, function(){ - var address = '' - if(ip == '0.0.0.0' || ip == '127.0.0.1') { - address = 'localhost' - } else { - address = ip - } - var hostUrl = "http://" + address + ":" + port + "/" + if(typeof program.ip == 'undefined') program.ip = '0.0.0.0' + if(typeof program.port == 'undefined') program.port = 9000 + harp.server(projectPath, { ip: program.ip, port: program.port }, function(){ + var host = this.address() + if(host.address == '0.0.0.0' || host.address == '127.0.0.1') host.address = 'localhost' + var hostUrl = "http://" + host.address + ":" + host.port + "/" output("Your server is listening at " + hostUrl) }) }) @@ -103,12 +99,13 @@ program .description("Start a Harp server to host a directory of Harp projects") .action(function(path, program){ var projectPath = nodePath.resolve(process.cwd(), path || "") - var port = program.port || 9000 - harp.multihost(projectPath, { port: port }, function(){ - if(port == "80"){ + if(typeof program.port == 'undefined') program.port = 9000 + harp.multihost(projectPath, { port: program.port }, function(){ + var host = this.address() + if(host.port == "80"){ var loc = "http://harp.nu" }else{ - var loc = "http://harp.nu:" + port + var loc = "http://harp.nu:" + host.port } output("Your server is hosting multiple projects at " + loc) }) diff --git a/lib/index.js b/lib/index.js index 8b1476b1..7639b47f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -54,6 +54,8 @@ exports.multihost = function(dirPath, options, callback){ app.use(middleware.process) app.use(middleware.fallback) app.listen(options.port || 9000, callback) + + return app } /** From 8f33f7248d73174e1c96c080281e2267b496529f Mon Sep 17 00:00:00 2001 From: Jurgen Van de Moere Date: Wed, 30 Mar 2016 20:51:37 +0200 Subject: [PATCH 2/3] feat(index): replace async.eachLimit with async.each to fix #538 --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 55e9ca64..c8f0dbf7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -249,11 +249,11 @@ exports.compile = function(projectPath, outputPath, callback){ if(err) console.log(err) helpers.ls(setup.publicPath, function(err, results){ - async.eachLimit(results, 72, compileFile, function(err){ + async.each(results, compileFile, function(err){ if(err){ callback(err) }else{ - async.eachLimit(results, 72, copyFile, function(err){ + async.each(results, copyFile, function(err){ setup.config['harp_version'] = pkg.version delete setup.config.globals callback(null, setup.config) From 501898d9ee9d964b67545dc369db35cf3f2110e8 Mon Sep 17 00:00:00 2001 From: Brock Whitten Date: Mon, 4 Apr 2016 12:57:27 -0700 Subject: [PATCH 3/3] version bump v0.20.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index efc14298..db98eb1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "harp", - "version": "0.20.1", + "version": "0.20.2", "description": "Static web server with built in preprocessing", "author": "Brock Whitten ", "contributors":