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 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');
var base = new Base();

Register the plugin

base.use(runner());

With the plugin registered, you can now call the .runner method with the name of the "configfile" to search for (e.g. verbfile.js, generator.js, assemblefile.js, etc):

base.runner('configfile.js', function(err, argv, app) {
  // `err`: error object
  // `argv`: command line arguments, parsed by minimist and pre-processed
  // `app`: instance of `base` with configfile.js invoked
});

Example usage

base.runner('generator.js', function(err, argv, app) {
  if (err) throw err;

  app.cli.process(argv, function(err) {
    if (err) throw err;

  });
});

API

Params

  • configfile {String}: The name of the configfile to initialize with. For example, generator.js, assemblefile.js, verbfile.js etc.
  • callback {Function}: Callback that exposes err, argv and app as arguments. argv is pre-processed by minimist then processed by expand-args. The original argv array is exposed on argv.orig, and the object returned by minimist is exposed on argv.minimist. app is the resolved application instance to be used.
  • returns {undefined}

Example

base.runner('verbfile.js', function(err, argv, app) {
  // handle err
  // do stuff with argv and app

  app.cli.process(argv, function(err) {
    // handle err
  });
});

.cwd

Set the current working directory.

Example

{
  "name": "my-project",
  "verb": {
    "cwd": "foo/bar"
  }
}

.data

Merge data onto the app.cache.data object. If the base-data plugin is registered, this is the API-equivalent of calling app.data().

Example

{
  "name": "my-project",
  "verb": {
    "data": {
      "foo": "bar"
    }
  }
}

.engines

Alias for engines

.engines

(Requires templates, otherwise ignored)

Register engines to use for rendering templates. Object-keys are used for the engine name, and the value can either be the module name, or an options object with the module name defined on the name property. (Modules must be locally installed and listed in dependencies or devDependencies).

Example

// module name
{"verb": {"engines": {"*": "engine-base"}}}

// options
{"verb": {"engines": {"*": {"name": "engine-base"}}}}

.helpers

(Requires templates, otherwise ignored)

Register helpers to use in templates. Value can be a string or array of module names, glob patterns, or file paths, or an object where each key is a filepath, glob or module name, and the value is an options object to pass to resolved helpers. (Modules must be locally installed and listed in dependencies or devDependencies).

Example

// module names
{
  "verb": {
    "helpers": {
      "helper-foo": {},
      "helper-bar": {}
    }
  }
}

// register a glob of helpers
{
  "verb": {
    "helpers": ["foo/*.js"]
  }
}

.options

Merge options onto the app.options object. If the base-option plugin is registered, this is the API-equivalent of calling app.option().

Example

{"verb": {"options": {"foo": "bar"}}}

.plugins

Load pipeline plugins. Requires the base-pipeline plugin to be registered.

(Modules must be locally installed and listed in dependencies or devDependencies).

Example

{"verb": {"plugins": {"eslint": {"name": "gulp-eslint"}}}}

.toc

Enable or disable Table of Contents rendering, or pass options on the verb config object in package.json.

Example

{
  "name": "my-project",
  "verb": {
    "toc": true
  }
}

.use

Define plugins to load. Value can be a string or array of module names.

(Modules must be locally installed and listed in dependencies or devDependencies).

Example

{"verb":  {"use": ["base-option", "base-data"]}}

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 March 05, 2016.