From 00fa37fff097e0572a66602e3d8b70a1f33d203b Mon Sep 17 00:00:00 2001 From: Craig Condon Date: Wed, 30 Jul 2014 11:12:20 -0700 Subject: [PATCH] start on using browserify --- lib/bundle.js | 29 +++++++++++++++++++++++++++++ lib/exe.js | 36 +++++++++++++++++++++--------------- package.json | 4 +++- 3 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 lib/bundle.js diff --git a/lib/bundle.js b/lib/bundle.js new file mode 100644 index 0000000..4765ff3 --- /dev/null +++ b/lib/bundle.js @@ -0,0 +1,29 @@ +var mdeps = require("module-deps"), +through = require("through"), +async = require("async"); + +function bundle (input, complete) { + + async.waterfall([ + + /** + */ + + function resolveDeps () { + + var deps = []; + + mdeps(input).pipe(through(function (chunk) { + deps.push(chunk); + }, function () { + + for (var i = deps.length; i--;) { + console.log(deps); + } + + })); + } + ]); +} + +module.exports = bundle; \ No newline at end of file diff --git a/lib/exe.js b/lib/exe.js index 56ec8f8..87fd773 100644 --- a/lib/exe.js +++ b/lib/exe.js @@ -1,17 +1,17 @@ -var async = require("async"), -outcome = require("outcome"), -mkdirp = require("mkdirp"), -request = require("request"), -path = require("path"), -fs = require("fs"), -ncp = require("ncp").ncp, -ProgressBar = require("progress"), -child_process = require("child_process"), -glob = require("glob"), -sardines = require("sardines"), -os = require("os"), -targz = require('tar.gz'), -spawn = child_process.spawn; +var async = require("async"), +outcome = require("outcome"), +mkdirp = require("mkdirp"), +request = require("request"), +path = require("path"), +fs = require("fs"), +ncp = require("ncp").ncp, +ProgressBar = require("progress"), +child_process = require("child_process"), +glob = require("glob"), +bundle = require("./bundle"), +os = require("os"), +targz = require('tar.gz'), +spawn = child_process.spawn; var _log = require("./log"), @@ -40,10 +40,16 @@ exports.compile = function (options, complete) { * bundle the application into one script */ - function combineProject (nc, next) { + /*function combineProject (nc, next) { nodeCompiler = nc; _log("bundle %s", options.input); sardines({ entries: [options.input], platform: "node" }, next); + },*/ + + function combineProject (nc, next) { + nodeCompiler = nc; + _log("bundle %s", options.input); + bundle(options.input, next); }, /** diff --git a/package.json b/package.json index dccbd3c..9571261 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,9 @@ "colors": "~0.6.2", "glob": "~3.2.9", "progress": "~1.1.3", - "tar.gz": "0.1.1" + "tar.gz": "0.1.1", + "module-deps": "^3.5.4", + "through": "^2.3.4" }, "preferGlobal": "true", "bin": {