Giter Site home page Giter Site logo

rlugojr / raml-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mulesoft-labs/raml-generator

0.0 2.0 0.0 43 KB

Generate files from a RAML document and Handlebars templates

License: Other

JavaScript 2.65% RAML 58.50% TypeScript 38.85%

raml-generator's Introduction

RAML Generator

NPM version NPM downloads Build status Test coverage

Generate files from a RAML document and templates.

Installation

npm install raml-generator --save

Usage

The module accepts a map of functions (usually compiled templates, such as Handlebars), and returns a function that will generate files given an instance of the RAML 1 parser JSON.

For an example module, take a look at the raml-javascript-generator.

Why use this? It's just a simple, high level API for creating generators with a standard API.

JavaScript Usage

Create the generator function from config. The returned object accepts two arguments, the RAML object and user config.

var fs = require('fs')
var Handlebars = require('handlebars')
var generator = require('raml-generator')

module.exports = generator({
  templates: {
    'index.js': Handlebars.compile(fs.readFileSync(__dirname + '/templates/index.js.hbs', 'utf8'))
  }
}) //=> [Function]

Bin Script

A bin script is provided for you to use with your custom generator. Just require raml-generator/bin and pass in the generator function (from above), package information (package.json) and process.argv.

#!/usr/bin/env node

var bin = require('raml-generator/bin')

var generator = /* The generator function */

bin(generator, require('./package.json'), process.argv)

Generated CLI:

generator --out [directory]

  --data, -d     Path to JSON configuration file
  --include, -i  Include additional RAML files (E.g. extensions)

License

Apache License 2.0

raml-generator's People

Contributors

blakeembrey avatar sichvoge avatar

Watchers

 avatar  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.