installall

Download and install all published versions of a npm module

installall

Download and install all published versions of a npm module. This can be useful in e.g. CI or benchmark systems, for example in level-bench, where we want to be able to benchmark all published versions against each other and not just the latest released versus the one currently developed.

Just require and install. The resulting array will give you the install path for each module which have their release tags appended to the base module name.

var installall = require('installall')
installall('levelup', function (errmodules) {
  if (err) return console.log(err)
  console.log(modules)
})

Gives the following output:

[ { path: '/home/magnus/src/installall/node_modules/levelup@0.0.0',
    status: 'installed' },
  { path: '/home/magnus/src/installall/node_modules/levelup@0.0.0-1',
    status: 'installed' },
    ...
  { path: '/home/magnus/src/installall/node_modules/levelup@0.7.0-b01',
    status: 'installed' },
  { path: '/home/magnus/src/installall/node_modules/levelup@0.7.0-b02',
    status: 'installed' } ]

The status property for each module is set to either installed or failed.

A little more useful scenario than just printing out all the modules is to try and require each of them to perform some tests like benchmarks or just simple sanity checks to make sure that everything can be installed and loaded without problems:

var installall = require('installall')
installall('somemodule', function (errmodules) {
  modules.forEach(function (module) {
    if (module.status == 'installed') {
      try {
        var foo = require(module.path)
        // Do stuff with foo .. 
      } catch (err) {
        console.log('Failed to require', module.path)
      }
    } else {
      console.log('Failed to install', module.path)
    }
  })
})
npm install installall

MIT