Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

generator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator

Project bootstrapping with an emphasis on simplicity.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
573
increased by24.3%
Maintainers
1
Weekly downloads
 
Created
Source

Generator Build Status

Language agnostic project bootstrapping with an emphasis on simplicity.

Screenshot

Installation

[sudo] npm install -g generator

Once installed, you should load the default templates:

generate --setup

Usage

In order to bootstrap a project using one of the default templates you simply run generate and specifiy a template and project name. For example, let's create a new Node.js module called kittycannon:

generate --template npm --name kittycannon

Default Templates

Generator comes with a few templates to get you started. While they are usable as-is, the whole point of Generator is make the creation of custom templates as simple as possible.

  • npm NPM module template
  • arduino Arduino project template

How Templates Work

Templates are simply directories with any combination of files and sub-directories found within them. To create a new template simply create a new directory within your ~/.generator path or copy one of the default templates and modify it. Upon use, Generator will walk the template looking for any instances of __somelowercasevariable__ and prompt for a value. For example, a template including this:

/**
 * __description__
 *
 * @package __name__
 * @author __author__ <__email__>
 */

Will prompt:

description: Rainbow catsplosion.
author: Nyan Cat
email: kitty@meow.com

Which will generate:

/**
 * Rainbow catsplosion.
 *
 * @package myAwesomeProject
 * @author Nyan Cat <kitty@meow.com>
 */

Post Processing

By default, Generator will look for a makefile and (if found) will run make generator after all other template processing has been completed. This is particularly handy for dealing with template dependencies that may change over time (like git repositories or even NPM modules). For example:

generator:
    npm install

.PHONY: generator

Or... heck, let's go crazy nuts and automate setting up our git repo:

generator:
    git init
    git remote add origin https://github.com/__github__/__name__
    npm install

.PHONY: generator

Testing

npm test

Notes

  • C, C++, and PHP often use the __SOMETHING__ pattern for macros. For this reason, Generator will ignore any variable instances that are specified in caps. This works fine for C and C++ users, but given that such macros in PHP are case insensitive, PHP users should keep this limitation in mind while designing templates.
  • "Good coders code. Great reuse." quote shamelessly stolen from Peteris Krumins' blog (which you should read).

Keywords

FAQs

Package last updated on 09 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc