JSPM

  • Created
  • Published
  • Downloads 23021
  • Score
    100M100P100Q132206F
  • License

Project generator, for node.js.

Package Exports

  • generate

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 (generate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

generate NPM version

Project generator, for node.js.

This is a working application, but it's not ready to use. If you're curious about what we're building, feel free to ask questions or pitch in and help us make a better generator system for node.js.

(Table of contents generated by [verb])

Project goals

The goal of this project is to offer an alternative to Yeoman that is:

  • easier to use, and easier to author generators
  • faster and lighter
  • should be composable and modular, allowing you to reuse logic across generators for things like:
    • tasks
    • plugins
    • middleware
    • loaders
    • templates
    • helpers
    • data

TODO

  • resolving global generators
  • loading global generators
  • path handling for generators
  • path handling for templates
  • template processing
  • data loading (for templates)
  • path handling for cwd
  • prompts
  • collision management

API

Generate

Create a generate generator.

var app = require('generate');

.src

Glob patterns or filepaths to source files.

  • glob {String|Array}: Glob patterns or file paths to source files.
  • options {Object}: Options or locals to merge into the context and/or pass to src plugins
app.src('*.js')

Example usage

app.task('web-app', function() {
  app.src('templates/*')
    app.dest(process.cwd())
});

.templates

Glob patterns or filepaths to templates stored in the ./templates directory of a generator.

  • glob {String|Array}: Glob patterns or file paths to source files.
  • options {Object}: Options or locals to merge into the context and/or pass to src plugins
app.templates('*.js')

Example usage

app.task('web-app', function() {
  app.templates('templates/*')
    app.dest(process.cwd())
});

.dest

Specify a destination for processed files.

  • dest {String|Function}: File path or rename function.
  • options {Object}: Options or locals to merge into the context and/or pass to dest plugins
app.dest('dist', {ext: '.xml'})

Example usage

app.task('sitemap', function() {
  app.src('templates/*')
    app.dest('dist', {ext: '.xml'})
});

.task

Define a generator.

  • name {String}
  • fn {Function}
app.task('docs', function() {
  app.src('*.js').pipe(app.dest('.'));
});

.gettask

Get the name of the currently running task. This is primarily used inside plugins.

  • returns {String} task: The currently running task.
app.gettask();

.transform

Transforms functions are used to exted the Generate object and are run immediately upon init and are used to extend or modify anything on the this object.

  • name {String}: The name of the transform to add.
  • fn {Function}: The actual transform function.
  • returns {Object}: Returns Generate for chaining.
app.transform('foo', function(app) {
  app.cache.foo = app.cache.foo || {};
});

.watch

Re-run the specified task(s) when a file changes.

  • glob {String|Array}: Filepaths or glob patterns.
  • fn {Function}: Task(s) to watch.
app.task('watch', function() {
  app.watch('docs/*.md', ['docs']);
});

Contributing

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

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb-cli on April 08, 2015.