Search node_modules for a specific prefix #2

Open
mattmcmanus opened this Issue Jun 19, 2013 · 2 comments

Projects

None yet

2 participants

@mattmcmanus
Owner

Allow for:

var cli = helmsman({ npmPrefix:'nabu-cli-' });

and it will automatically search the libraries npm installed packages and add any exposed 'commands'

@missinglink

hey @mattmcmanus this would be really cool, are you still interested in doing something this this?

@missinglink

as a hacky work-around, I just ended up doing this:

#!/usr/bin/env node

// load binaries from node_modules
var pkg = require('../package');
pkg.commands.forEach( function( moduleName ){
  process.env.PATH += ':' + process.cwd() + '/node_modules/' + moduleName + '/bin';
});

var helmsman = require('helmsman');
helmsman({ usePath: true }).parse();

... and in my package.json

  "commands": [
    "submodule1",
    "submodule2"
  ],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment