JSPM

  • Created
  • Published
  • Downloads 24888
  • Score
    100M100P100Q132908F
  • License MIT

Orchestrate multiple instances of base-methods at once.

Package Exports

  • base-runner

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (base-runner) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

base-runner NPM version NPM downloads Build Status

Orchestrate multiple instances of base-methods at once.

Install

Install with npm:

$ npm install base-runner --save

Usage

var runner = require('base-runner');
var Base = require('base');

runner(Base, config, argv, function(err, app, runnerContext) {
  // `err`: error object
  // `app`: instance of `base` 
  // `runnerContext`: object with `argv`, `env` and `config` properties
});

API

runner

Create a runner with the given constructor, liftoff config object, argv object and callback function.

Params

  • Ctor {Function}: Constructor to use, must inherit base.
  • config {Object}: The config object to pass to liftoff.
  • argv {Object}: Argv object, optionally pre-parsed.
  • cb {Function}: Callback function, which exposes err, app (base application instance) and runnerContext
  • returns {Object}

Example

var Base = require('base');
var argv = require('minimist')(process.argv.slice(2));
var config = {
  name: 'foo',
  cwd: process.cwd(),
  extensions: {'.js': null}
};

runner(Base, config, argv, function(err, app, runnerContext) {
  if (err) throw err;
  // do stuff with `app` and `runnerContext`
  process.exit();
});

Events

The following constructor events are emitted:

preInit

Exposes runnerContext as the only paramter.

Base.on('preInit', function(runnerContext) {
});

init

Exposes runnerContext and app (the application instance) as paramters.

Base.on('init', function(runnerContext, app) {
});

postInit

Exposes runnerContext and app (the application instance) as paramters.

Base.on('postInit', function(runnerContext, app) {
});

finished

Exposes runnerContext and app (the application instance) as paramters.

Base.on('finished', function(runnerContext, app) {
});

You might also be interested in these projects:

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on April 20, 2016.