Naboo's Podracing Misadventure
Have ideas to improve npm?Join in the discussion! »

generate-collections

0.1.0 • Public • Published

generate-collections NPM version Build Status

Add the docs, includes, badges, and layouts collections, along with a few generic defaults to your generator.

You might also be interested in generate-defaults.

Install

Install with npm:

$ npm i generate-collections --save

getting started

If you're not already familiar with [generate][], you might find generate's getting started guide useful before continuining.

Usage

Extend your generator with features and settings from generate-collections:

var readme = require('generate-collections');
 
module.exports = function(app) {
  readme.invoke(app, [options]);
 
  // do generator stuff
};

That's it! you should now be able to use any features from generate-collections as if they were created in your own generator.

Advanced usage

Lazily-extend your generator with features and settings from generate-collections.

This approach offers the advantage of choosing when and where to invoke generate-collections inside your own generator, through the use of tasks.

module.exports = function(app) {
  app.extendWith(require('generate-collections'));
 
  // do generator stuff
 
  // you must run the `readme task before you use 
  // any of the features from generate-collections
  app.task('default', ['readme', ])
};

API

If a collection does already exist on the instance, its options will be updated with any options defined on your application instance, or options passed directly to the load function. In your generator:

Params

  • app {Object}: instance of generator, verb or assemble.

Example

app.extendWith(require('generate-collections'));

task

Exposes the collections task function directly, so you can register the task with any name that makes sense for your project.

Params

  • app {Object}
  • returns {Function}: Returns the task callback

Example

var collections = require('generate-collections');
app.task('foo', collections.task(app));

.invoke

Exposes the generator on the invoke property, allowing you to load the collections wherever and whenever it makes sense.

Params

  • app {Object}
  • options {Object}

Example

var collections = require('generate-collections');
 
// in your generator
collections.invoke(app, [options]);

Compatibility

This generator works with:

  • [generate][]
  • verb
  • update (soon)
  • assemble (soon)

Related projects

  • assemble: Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… more | homepage
  • generate: Fast, composable, highly extendable project generator with a user-friendly and expressive API. | homepage
  • verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage

Generate docs

Generate readme and API documentation with verb:

$ npm i -d && npm run docs

Or, if verb is installed globally:

$ verb

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 © 2016 Jon Schlinkert Released under the MIT license.


This file was generated by verb, v0.9.0, on February 14, 2016.

Install

npm i [email protected]

Version

0.1.0

License

MIT

Last publish

Collaborators

  • avatar