From ddea85464997a36372e9a28ad121b213c2e1b7cf Mon Sep 17 00:00:00 2001 From: Craig Condon Date: Tue, 9 Apr 2013 13:37:45 -0700 Subject: [PATCH] replace browserify with sardines --- examples/hello-world/browser.js | 1 + examples/hello-world/index.js | 11 ++++++++++- examples/hello-world/makefile | 2 +- examples/hello-world/package.json | 4 ++++ lib/index.js | 18 +++++++----------- package.json | 6 +++--- 6 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 examples/hello-world/browser.js mode change 100644 => 100755 examples/hello-world/index.js mode change 100644 => 100755 examples/hello-world/makefile create mode 100644 examples/hello-world/package.json diff --git a/examples/hello-world/browser.js b/examples/hello-world/browser.js new file mode 100644 index 0000000..9872315 --- /dev/null +++ b/examples/hello-world/browser.js @@ -0,0 +1 @@ +console.log("hello browser!"); \ No newline at end of file diff --git a/examples/hello-world/index.js b/examples/hello-world/index.js old mode 100644 new mode 100755 index c7a73b5..9d4e33e --- a/examples/hello-world/index.js +++ b/examples/hello-world/index.js @@ -1 +1,10 @@ -console.log("hello world!!"); \ No newline at end of file +var http = require("http"), +port = 1337; + +console.log(process.argv); + +console.log("started HTTP server on port %d", 1337); + +http.createServer(function(req, res) { + res.end("Hello World!!"); +}).listen(port); \ No newline at end of file diff --git a/examples/hello-world/makefile b/examples/hello-world/makefile old mode 100644 new mode 100755 index 9bfedb5..fe19143 --- a/examples/hello-world/makefile +++ b/examples/hello-world/makefile @@ -1,2 +1,2 @@ all: - nexe -i ./index.js -o ./hello-world.nex -r 0.8.18 \ No newline at end of file + nexe -i ./ -o ./hello-world.nex -r 0.8.18 \ No newline at end of file diff --git a/examples/hello-world/package.json b/examples/hello-world/package.json new file mode 100644 index 0000000..9eeffe6 --- /dev/null +++ b/examples/hello-world/package.json @@ -0,0 +1,4 @@ +{ + "main": "./index.js", + "browser": "./index.js" +} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index cac5e36..47aac10 100644 --- a/lib/index.js +++ b/lib/index.js @@ -8,8 +8,8 @@ child_process = require("child_process"), exec = child_process.exec, spawn = child_process.spawn, sprintf = require("sprintf").sprintf, -browserify = require("browserify"), -ncp = require("ncp").ncp; +ncp = require("ncp").ncp, +sardines = require("sardines"); /** */ @@ -37,18 +37,14 @@ exports.compile = function(args, next) { on.success(function(node) { console.log("making application bundle with %s", args.input); this.node = node; - var b = browserify(); - b.addEntry(args.input); - this(null, b.bundle()); + + sardines({ entries: [args.input], platform: "node" }, this); }), - /** - * 3. write the file into the node libs directory - */ - on.success(function(bundle) { - console.log("writing application bundle"); - fs.writeFile(this.nexePath = path.join(this.node.dir, "lib", "nexe.js"), bundle, "utf8", this); + on.success(function(content) { + console.log("writing application bundle: \n\n%s\n\n", content); + fs.writeFile(this.nexePath = path.join(this.node.dir, "lib", "nexe.js"), content, "utf8", this); }), /** diff --git a/package.json b/package.json index 175322d..77af558 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Craig Condon ", "name": "nexe", "description": "Roll node.s applications into a single executable", - "version": "0.1.2", + "version": "0.2.1", "repository": { "type": "git", "url": "git://github.com/crcn/nexe.git" @@ -13,10 +13,10 @@ "sprintf": "0.1.x", "step": "0.0.x", "optimist": "0.3.x", - "browserify": "1.16.x", "request": "2.12.x", "ncp": "0.2.x", - "mkdirp": "0.3.x" + "mkdirp": "0.3.x", + "sardines": "0.4.x" }, "bin": { "nexe": "./bin/nexe"