diff --git a/bin/harp b/bin/harp index c27369f..51a9e46 100755 --- a/bin/harp +++ b/bin/harp @@ -117,7 +117,7 @@ if (argv["_"].length === 2){ console.log(" ", "Generating Site & Bundling Assets...".blue) console.log() - harp.compile(projectPath, buildPath, function(errors, output){ + harp.compile(projectPath, buildPath, { output: true }, function(errors, output){ if(errors) { console.log(JSON.stringify(errors, null, 2)) process.exit(1) diff --git a/lib/index.js b/lib/index.js index c39b741..a219b19 100644 --- a/lib/index.js +++ b/lib/index.js @@ -154,7 +154,12 @@ exports.middleware = middleware; * */ -exports.compile = function(projectPath, outputPath, callback){ +exports.compile = function(projectPath, outputPath, options, callback){ + if (!callback){ + callback = options + options = { output: false } + } + const compileStart = process.hrtime() var stats = { @@ -225,7 +230,9 @@ exports.compile = function(projectPath, outputPath, callback){ var sizeHuman = toHuman(sizeInBytes) var sizePadded = sizeHuman.padStart(8, " ") var filePath = `/${ terraform.helpers.outputPath(file) }` - console.log(sizePadded.green, filePath) + if (options.output){ + console.log(sizePadded.green, filePath) + } fs.writeFile(dest, body, done) }) }) @@ -248,7 +255,9 @@ exports.compile = function(projectPath, outputPath, callback){ var sizeHuman = toHuman(sizeInBytes) var sizePadded = sizeHuman.padStart(8, " ") var filePath = `/${ file }` - console.log(sizePadded.grey, filePath) + if (options.output){ + console.log(sizePadded.grey, filePath) + } fs.copy(path.resolve(setup.publicPath, file), localPath, done) }) }) diff --git a/package-lock.json b/package-lock.json index 7fc933e..a6c7136 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "harp", - "version": "0.44.0", + "version": "0.45.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "harp", - "version": "0.44.0", + "version": "0.45.0", "license": "MIT", "dependencies": { "@colors/colors": "1.5.0", diff --git a/package.json b/package.json index 3ca4c3a..04fc894 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "harp", - "version": "0.44.0", + "version": "0.45.0", "description": "Static Web Server/Generator/Bundler", "author": "Brock Whitten ", "contributors": [ diff --git a/test/basic.js b/test/basic.js index df7cf34..eb48304 100644 --- a/test/basic.js +++ b/test/basic.js @@ -13,12 +13,12 @@ describe("basic", function(){ before(function(done){ harp.compile(projectPath, outputPath, function(errors, output){ - config = output + config = output.config server = harp.server(projectPath).listen(8100, done) }) }) - it("should have node version in config", function(done){ + it("should have harp version in config", function(done){ config.should.have.property("harp_version") done() }) diff --git a/test/plain.js b/test/plain.js index e5e5cb8..e1a5c64 100644 --- a/test/plain.js +++ b/test/plain.js @@ -16,12 +16,12 @@ describe("plain", function(){ before(function(done){ harp.compile(projectPath, outputPath, function(errors, output){ - config = output + config = output.config server = harp.server(projectPath).listen(8102, done) }) }) - it("should have node version in config", function(done){ + it("should have harp version in config", function(done){ config.should.have.property("harp_version") done() }) @@ -75,12 +75,12 @@ describe("plain", function(){ before(function(done){ harp.compile(projectPath, outputPath, function(errors, output){ - config = output + config = output.config server = harp.server(projectPath).listen(8103, done) }) }) - it("should have node version in config", function(done){ + it("should have harp version in config", function(done){ config.should.have.property("harp_version") done() })