JSPM

  • Created
  • Published
  • Downloads 23021
  • Score
    100M100P100Q131582F
  • 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

Initialize Generate

var generate = new Generate();

.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.
generator.transform('foo', function(generate) {
  generate.cache.foo = generate.cache.foo || {};
});

.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
generator.src('*.js')

Example usage

generator.task('web-app', function() {
  generate.src('templates/*.tmpl')
    generate.dest('project')
});

.templates

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
generator.src('*.js')

Example usage

generator.task('web-app', function() {
  generate.src('templates/*.tmpl')
    generate.dest('project')
});

.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
generator.dest('dist', {ext: '.xml'})

Example usage

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

.task

Define a generator.

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

.gettask

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

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

.watch

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

  • glob {String|Array}: Filepaths or glob patterns.
  • fn {Function}: Task(s) to watch.
generator.task('watch', function() {
  generator.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.