scaff

0.0.4 • Public • Published

scaff(1)

Language-agnostic scaffolding engine

What?

I wanted a tool I could use with any project, in any language, to generate code that I copied with every new project. Each language has their own tools (rails, rebar, ngen, etc).

I wanted a common cli that was agnostic to the structure of an app and let it be extended by templates pulled down from github. This is scaff.

Getting Started

Install the scripts with npm

npm install -g scaff

Create an Application

To get started use the scaff new <name> -t, --template <template> command and specify a directory and template to use

scaff new my-cool-app --template git://github.com/CamShaft/scaff-express.git

This will clone down the template and setup the inital project structure:

Cloning into '/Users/cameron/Projects/my-cool-app/.scaff/template'...
remote: Counting objects: 39, done.
remote: Compressing objects: 100% (24/24)done.
remote: Total 39 (delta 1), reused 38 (delta 0)
Receiving objects: 100% (39/39), 4.41 KiB, done.
Resolving deltas: 100% (1/1)done.
 
Express 3 Template:
  Project description: This is a really cool project!
  Enter your name: Cameron Bytheway
  Enter your email: cameron@nujii.com
 
  create : /Users/cameron/Projects/my-cool-app/.gitignore
  create : /Users/cameron/Projects/my-cool-app/app
  create : /Users/cameron/Projects/my-cool-app/app/css
...
  create : /Users/cameron/Projects/my-cool-app/test/server
  create : /Users/cameron/Projects/my-cool-app/server/app.test.js

Listing the Generators

You can print out a list of available generators using scaff generate

cd my-cool-app
scaff generate

Using a Generator

scaff generate <generator>

The generator will walk you through a series of questions and generate the new files:

scaff generate route

Express 3 Route:
  Route name: project
  Route: /projects/:id

  create : /Users/cameron/Projects/my-cool-app/routes/project.js
  create : /Users/cameron/Projects/my-cool-app/test/server/routes/project.test.js
  modify : /Users/cameron/Projects/my-cool-app/app.js

Making a Template

More to come... For now check out the examples

Credits

Credits go to visionmedia's ngen. The biggest difference from ngen and scaff is the ability to pull down templates per project and the generators. The templates for the most part should be compatible.

I also took inspiration from the rails cli for generating a bunch of boiler plate code with one command.

Readme

Keywords

none

Package Sidebar

Install

npm i scaff

Weekly Downloads

2

Version

0.0.4

License

MIT

Last publish

Collaborators

  • camshaft