JSPM

  • Created
  • Published
  • Downloads 24888
  • Score
    100M100P100Q132892F
  • 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

Orchestrate multiple instances of base-methods at once.

Install

Install with npm

$ npm i base-runner --save

Usage

var path = require('path');
var runner = require('base-runner');
var Generate = require('generate');

Generate.mixin(runner('generate', 'generator'));

var base = Generate.getConfig('generator.js')
  .resolve('generate-*/generator.js', {
    cwd: '@/'
  })
  .resolve('*/generator.js', {
    cwd: path.join(__dirname, 'fixtures')
  })
  .resolve('generator.js', {
    cwd: __dirname
  });

API

.getConfig

Static method for getting the very first instance to be used as the base instance. The first instance will either be defined by the user, like in local node_modules, or a globally installed module that serves as a default/fallback.

Params

  • filename {String}: Then name of the config file to lookup.
  • returns {Object}: Returns the "base" instance.

Example

var base = Base.getConfig('generator.js');

.getTask

Get task name from the runner.tasks object.

Params

  • name {String}
  • returns {Object}

Example

runner.getTask('abc');

// get a task from app `foo`
runner.getTask('foo:abc');

// get a task from sub-app `foo.bar`
runner.getTask('foo.bar:abc');

.addApp

Alias for register. Adds an app with the given name to the runner.apps object.

Params

  • name {String}: The name of the config object to register
  • config {Object|Function}: The config object or function

.hasApp

Return true if app name is registered. Dot-notation may be used to check for sub-apps.

Params

  • name {String}
  • returns {Boolean}

Example

base.hasApp('foo.bar.baz');

.getApp

Return app name is registered. Dot-notation may be used to get sub-apps.

Params

  • name {String}
  • returns {Boolean}

Example

base.getApp('foo');
// or
base.getApp('foo.bar.baz');

.extendApp

Extend an app.

Params

  • app {Object}
  • returns {Object}: Returns the instance for chaining.

Example

var foo = base.getApp('foo');
foo.extendApp(app);

.invoke

Invoke app fn with the given base instance.

Params

  • fn {Function}: The app function.
  • app {Object}: The "base" instance to use with the app.
  • returns {Object}

Example

runner.invoke(app.fn, app);
  • base-methods: Starter for creating a node.js application with a handful of common methods, like set, get,… more | homepage
  • base-options: Adds a few options methods to base-methods, like option, enable and disable. See the readme… more | homepage
  • base-plugins: Upgrade's plugin support in base-methods to allow plugins to be called any time after init. | homepage
  • base-resolver: 'base-methods' plugin for resolving and loading globally installed npm modules. | homepage
  • base-store: Plugin for getting and persisting config values with your base-methods application. Adds a 'store' object… more | homepage

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

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

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on December 03, 2015.