diff --git a/.gitignore b/.gitignore index 76a561f..b70d58f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ test/**/test.nex test/**/tmp test/**/node_modules test/**/*.map +test/src src .idea diff --git a/lib/exe.js b/lib/exe.js index 378db9a..4f369de 100644 --- a/lib/exe.js +++ b/lib/exe.js @@ -700,17 +700,19 @@ function _monkeyPatchChildProcess(compiler, complete) { */ function _monkeyPatchMainCc(compiler, complete) { - var mainPath = path.join(compiler.dir, "src", "node.cc"); - var mainC = fs.readFileSync(mainPath, { + let finalContents; + + let mainPath = path.join(compiler.dir, "src", "node.cc"); + let mainC = fs.readFileSync(mainPath, { encoding: 'utf8' }); // content split, and original start/end - var constant_loc = 1; - var lines = mainC.split('\n'); - var startLine = lines.indexOf(' // TODO use parse opts'); - var endLine = lines.indexOf(' option_end_index = i;'); // pre node 0.11.6 compat - var isPatched = lines.indexOf('// NEXE_PATCH_IGNOREFLAGS'); + let constant_loc = 1; + let lines = mainC.split('\n'); + let startLine = lines.indexOf(' // TODO use parse opts'); + let endLine = lines.indexOf(' option_end_index = i;'); // pre node 0.11.6 compat + let isPatched = lines.indexOf('// NEXE_PATCH_IGNOREFLAGS'); if (isPatched !== -1) { _log('already patched node.cc'); @@ -955,6 +957,11 @@ exports.package = function(path, options) { _package = require(path); } + if(!_package || !_package.nexe) { + _log('error', 'trying to use package.json variables, but not setup to do so!'); + process.exit(1); + } + // replace ^$ w/ os specific extension on output if (isWin) { _package.nexe.output = _package.nexe.output.replace(/\^\$/, '.exe') // exe @@ -992,12 +999,6 @@ exports.package = function(path, options) { _log("log", v + " => '" + _package.nexe[v] + "'"); } }); - Object.keys(_package.nexe.runtime).forEach(function(v, i) { - _log("log", "runtime." + v + " => '" + _package.nexe.runtime[v] + "'"); - }); - Object.keys(_package.nexe.browserify).forEach(function(v, i) { - _log("log", "browserify." + v + " => '" + _package.nexe.browserify[v] + "'"); - }); return obj; } diff --git a/test/embeded-files/package.json b/test/embeded-files/package.json index fae99db..518aafb 100644 --- a/test/embeded-files/package.json +++ b/test/embeded-files/package.json @@ -21,7 +21,7 @@ "debug": false, "runtime": { "framework": "node", - "version": "5.5.0" + "version": "5.7.0" } } } diff --git a/test/express-test/bin/www b/test/express-test/bin/www index bb55f20..6924086 100755 --- a/test/express-test/bin/www +++ b/test/express-test/bin/www @@ -1,5 +1,4 @@ #!/usr/bin/env node -require('source-map-support').install(); /** * Module dependencies. @@ -90,4 +89,4 @@ function onListening() { debug('Listening on ' + bind); } -console.log(true); +process.stdout.write(true); diff --git a/test/express-test/package.json b/test/express-test/package.json index 32ca0b7..d1821da 100644 --- a/test/express-test/package.json +++ b/test/express-test/package.json @@ -17,11 +17,11 @@ "nexe": { "input": "bin/www", "output": "test.nex", - "temp": "src", - "debug": true, + "temp": "../src", + "debug": false, "runtime": { "framework": "node", - "version": "5.5.0", + "version": "5.7.0", "ignoreFlags": true } } diff --git a/test/flags-test/index.js b/test/flags-test/index.js index bf2016c..bff2ab1 100644 --- a/test/flags-test/index.js +++ b/test/flags-test/index.js @@ -10,4 +10,4 @@ let isStrict = (function() { return !this; })(); - console.log('test:strict-mode:status =', isStrict); + console.log(isStrict); diff --git a/test/flags-test/package.json b/test/flags-test/package.json index 5d6ac2e..1819340 100644 --- a/test/flags-test/package.json +++ b/test/flags-test/package.json @@ -6,7 +6,7 @@ "temp": "../src", "runtime": { "framework": "node", - "version": "0.10.0", + "version": "5.7.0", "ignoreFlags": false, "js-flags": "--use_strict", "node-args": "" diff --git a/test/gulp-test-170/package.json b/test/gulp-test-170/package.json index 44048a0..eac3ce5 100644 --- a/test/gulp-test-170/package.json +++ b/test/gulp-test-170/package.json @@ -11,5 +11,16 @@ "dependencies": { "gulp": "^3.9.0", "nexe": "^1.0.5" + }, + "nexe": { + "input": "./index.js", + "output": "test.nex", + "temp": "../src", + "runtime": { + "framework": "node", + "version": "5.7.0", + "ignoreFlags": true, + "node-args": "" + } } } diff --git a/test/ignoreFlags-test/package.json b/test/ignoreFlags-test/package.json index 7e34896..6d05e13 100644 --- a/test/ignoreFlags-test/package.json +++ b/test/ignoreFlags-test/package.json @@ -6,7 +6,7 @@ "temp": "../src", "runtime": { "framework": "node", - "version": "5.5.0", + "version": "5.7.0", "ignoreFlags": true, "node-args": "" } diff --git a/test/js-yaml-148/package.json b/test/js-yaml-148/package.json index eb59f5c..34b183b 100644 --- a/test/js-yaml-148/package.json +++ b/test/js-yaml-148/package.json @@ -16,7 +16,7 @@ "output": "test.nex", "temp": "../src", "runtime": { - "version": "5.5.0", + "version": "5.7.0", "framework": "node" } }