/projgen

language agnostic CLI that builds project scaffolding based on templates and prompts

Primary LanguageJavaScript

Projgen

Projgen generates projects from templates

Whats a template look like

Just a set of files and a yaml config file.

config.yml
src/package.json
src/README.md
src/lib/index.js
src/test/index.js

Whats the config file for

Well, its for configuring a few things like:

  • setting variables within template files
  • setting up prompts which set variables within template files
  • running some commands after the generator finishes

it looks something like:

metadata :
  author : 'Mike McFarland'         # automatically set author for templates
prompts :
  - 'name'                          # prompt user for a name and set it to the value provided
  - key : 'license'                 # ask about license (but have default be ISC)
    default : 'ISC'
  - 'description'
cmds :
  - 'git init'
  - 'npm install --save-dev mocha'  # install the latest mocha

Variables?

Yes, the files in your template directory can have parameters, like so:

{
  "name": "{{name}}",
  "description": "{{description}}",
  "repository": "git://github.com/{{repository}}.git",
  "version": "0.0.0",
  "license": "{{license}}",
  "main": "lib/index.js"
}

Files are run through Swig.

Installation

Its an npm module, and can be installed with

npm install -g projgen

then you need to configure a templates directory, you can do this with

projgen -t ~/absolute/path/to/templates

I have my templates directory in version control here.

License

ISC

Planned

update npm docs/version

include screengrabs

add to blog

include templated script and filename in docs