Coder Social home page Coder Social logo

scaff's Introduction

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: [email protected]

  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.

scaff's People

Contributors

camshaft avatar timshadel avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.