appgen

A toolkit for building multiple versions of the same app.

npm install appgen
12 downloads in the last month

appgen - Node.js module

A software development toolkit that lets you generate many different versions of the same app.

If you're using this module, feel free to contact me on twitter if you have any questions! :) @rjrodger

Current Version: 0.1.1

Tested on: node 0.8.6

The appgen module is a build tool similar to make or ant, except that
it can produce multiple versions of the same app from a common set of
resources. You can easily handle platform quirks, compatibility
issues, skinning, feature selection by defining variations within a
well-defined build structure.

The appgen module can help you build HTML5 cross-platform apps,
hybrid apps, native apps, or entire services that need to have mobile,
tablet, web, tv or other interfaces.

You can also buils variants of the same app, where you need to reskin
for different clients, or pick and choose features. You can even build
apps on demand.

You still have to provide the app source code, of course, but instead
of tearing your hair out with CSS hacks, platform sniffing if
statements, and last minute cut-and-paste desparation, you can get
your code back under control.

Code Example

Take these as your base files, the templates from which your app is built:

index.html:

  
  

 Hello <%="World!"%>

ios.css:

body {
  background-color: blue;
}

android.css:

body {
  background-color: black;
}

And define a build specification to create two versions of your app:
an iOS fork, and an Android fork:

simple-spec.js:

module.exports = {
  conf: { title:'Generic' },
  steps: [
    { name:'fork', forks: [ 
      { name:'ios',     conf: { title:'iOS' }}, 
      { name:'android', conf: { title:'Android' }} 
    ] },
    { name:'import',   path:'${name}.css' },
    { name:'template', path:'index.html' }
  ]
}

This build specification also copies in ios.css or android.css
depending on the name of the fork. The index.html file is a template.

Then you can run appgen to generate two versions:

$ appgen -v simple-spec.js
fork: main: {"title":"Generic"}
fork: main-ios: {"title":"iOS"}
save: {"path":"ios.css"}
save: {"path":"index.html"}
fork: main-android: {"title":"Android"}
save: {"path":"android.css"}
save: {"path":"index.html"}

By default the gen folder contains the output versions, each
in a separate folder. In this case, main-ios, and
main-android. All these things are configurable.

Why?

  • You need to build lots of similar apps
  • You need to support multiple configurations
  • You need to build cross-platform HTML5 apps
  • You need to let users create pre-defined apps
  • You need a ready-made way to organize your code

Installation

To install as a development tool:

npm install -g appgen

Or, if you are using it within a service:

npm install appgen

And in your code:

var appgen = require('appgen')

var generator = new appgen.AppGen({spec:{conf:..., steps:...}})
generator.exec({title:'My Title'}, function(err,log){ ... })

Key Concepts

Resources

Transformation Steps

Settings and Context

Forks

Build Specifications

Structure

Formats

gen Schema

Macros

Writing Your Own Build Steps

npm loves you