node package manager


* Command-line tool * module * express-like middleware


  • Command-line tool
  • module
  • express-like middleware

for packaging of javascript, coffeescript & other^script code within a folder structure to

  • memory at runtime for development
  • file for production

Inspired by nibjs, following CommonJS, packages can be distributed via npm.

follwing will take sourceFolder/package.json and combine all supported scripts to destinationFile

packageme sourceFolder destinationFile
var package = require("packageme");

// will write sourceFolder to destinationFile, invoking resultHandler on end
package(sourceFolder).toFile(destinationFile, resultHandler); 

// will write sourceFolder to string, invoking resultHandler(string) on end

// will pipe the sourceFolder to string, will invoke stream.end() once finished.
// will return sourceFolder packaged at URI /packages/packageName based on sourceFolder/package.json
// toURI respects the NODE_ENV flag, and will optimize package process in production mode to happen only once.
// will return module instance of packageName's main module.
var library = packageme.require("packageName");

// will return module instance of moduleA within package 'packageName'
var module = packageme.require("packageName/libs/moduleA");

// require statements act as they should even within modules
// requires respect the actual sever-side structure of the code, nevertheless they are emulated within the browser.
var module = require("./innerModule");
var module2 = require("../outerModule");
var module3 = require("packageName");

// innerModule.js
exports.myFunction = function() {}

// outerModule.js
module.exports = function() {}

// package/index.js
module.exports = {}