Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.
You might also be interested in update.
Get in touch!
Interested in seeing how generate works first-hand before reading another line? See the quickstart instructions.
Generate is a developer tool for rapidly generating files, code snippets, and even complete projects by using templates, answers to prompts, stored preferences, user environment and so on.
All of the actual "generating" is accomplished using plugins called generators, which can be run by command line or using Generate's API.
The project you are currently visiting is Generate's core codebase, which provides the command line tool and API for creating, resolving, registering, and running "generators".
There are other project scaffolders out there, why should you spend your time learning to use Generate?
In a nutshell, Generate offers the robustness, power and configurability of Yeoman, with the expressiveness and simplicity of Slush. See the following links if you're interested in a more detailed comparison:
.destto read and write globs of files.
Generate can be used as a standalone library, but it can also be used alongside the following libraries as part of a build workflow:
The following instructions are intended to provide a basic demonstration of how Generate works. Visit the links after this section for more information.
1. Install generate
To use Generate's CLI, it must first be installed globally using npm. You can do that now with the following command.
$ npm install --global generate
This adds the
gen command to your system path, allowing it to be run from anywhere.
2. Install a "generator"
To see how generators work, install
$ npm install --global generate-example
Run the example generator with the following command:
$ gen example
This appends the string
foo to the contents of
example.txt. Visit the generate-example project for additional steps and guidance.
Tell Generate's CLI to automatically run certain generators every time the
gen command is given:
$ gen init
You can run this command whenever you want to generate your preferences, like after installing new generators.
With macros you can create a completely custom generator, or generator experience, from the command line.
The following will create macro
foo with the arguments
project:minimal travis editorconfig:
$ gen --macro foo project:minimal travis editorconfig
Now, you can simly run
$ gen foo instead of
$ gen project:minimal travis editorconfig.
How do macros work?
--macro flag is used, the
process.argv array that was passed with the macro (excluding the
--macro flag itself and the macro name) is persisted to a macro-store. The next time macro name is used as a command line argument, the stored argv array is returned instead.
See macro-store for more details.
Note that all command line options are preceded by
- for abbreviations. Only generator names or tasks can be used as commands (without
-d: Set the destination directory to use for generated files.
--no-install: Don't automatically install
devDependenciesafter generating files.
--no-hints: Don't use hints in prompts
Plugins from any applications built on base should work with Generate (and can be used in your generator):
Visit the generator documentation guide to learn how to use, author and publish generators.
Changelog entries are classified using the following labels (from keep-a-changelog):
added: for new features
changed: for changes in existing functionality
deprecated: for once-stable features removed in upcoming releases
removed: for deprecated features removed in this release
fixed: for any bug fixes
bumped: updated dependencies, only minor or higher will be listed.
cwdis set and
destis set on
common-configAPI is exposed on the
app.commonproperty, so you can begin using it in generators.
Here are some suggestions!
@generatejsor use the
generatejstag in questions)
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for avice on opening issues, pull requests, and coding standards.
Install dev dependencies:
$ npm install -d && npm test
This file was generated by verb-generate-readme, v0.1.31, on October 01, 2016.