From d0e259be6f1d3b0b80afbaa8b2b8b79a80de6393 Mon Sep 17 00:00:00 2001 From: Craig Condon Date: Sat, 26 Nov 2011 17:24:25 -0600 Subject: [PATCH] can build node.js file from cwd now --- bin/nexe | 11 ++++++++--- lib/index.js | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/nexe b/bin/nexe index 2326de4..cbac202 100755 --- a/bin/nexe +++ b/bin/nexe @@ -1,16 +1,20 @@ #!/usr/bin/env node +var path = require('path'); + var argv = require('optimist'). usage('Usage: $0 -i [sources] -o [binary]'). options('i', { demand: true, alias: 'input', - desc: 'The entry javascript files' + desc: 'The entry javascript files', + default: process.cwd() }). options('o', { demand: true, alias: 'output', - desc: 'The output binary' + desc: 'The output binary', + default: process.cwd() + path.basename(process.cwd()) + '.nex' }). options('r', { alias: 'runtime', @@ -19,7 +23,8 @@ options('r', { }).argv; -require('../lib').compile({ entries: argv.input.split(' '), output: argv.output, runtime: argv.r }, function(error) { + +require('../lib').compile({ entries: argv.i.split(' '), output: argv.o, runtime: argv.r }, function(error) { if(error) console.log(error.message); }); \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index 4312e51..6f29002 100644 --- a/lib/index.js +++ b/lib/index.js @@ -205,6 +205,7 @@ exports.compile = function(ops, callback) { console.log('Making executable'); + var proc = spawn('make', [], { cwd: node.path }); proc.stdout.on('data', function(data) {