Code generation engine. Inspired by the work in mattdesl/quick-stub.
$ npm install initialize-engine
const initializeEngine = require('initialize-engine')
const mkdirp = require('mkdirp')
const path = require('path')
initializeEngine({
pre: [ createDir ],
files: [
'.gitignore',
'LICENSE',
'README.md',
'index.js',
'package.json',
],
devDependencies: [ 'istanbul', 'standard', 'tape' ]
}, { d: '../foobar' })
// create specified path
// (obj, fn) -> null
function createDir (argv, next) {
const loc = path.resolve(path.join(argv.d, argv.name))
mkdirp(loc, function (err) {
if (err) return next(err)
process.chdir(loc)
argv.directory = loc
argv.d = loc
next()
})
}
Run the engine with the given opts, and an optional settings object to extend. Opts are run in sequence. The following opts are available:
_.
Files are populated with variables using the {{varName}} syntax.