Socket
Socket
Sign inDemoInstall

raml-generator

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raml-generator

Generate files from a RAML document and Handlebars templates


Version published
Weekly downloads
21
decreased by-22.22%
Maintainers
1
Weekly downloads
 
Created
Source

RAML Generator

NPM version NPM downloads Build status Test coverage

Generate files from a RAML document and Handlebars templates.

Installation

npm install raml-generator --save

Usage

The module accepts a map of Handlebars templates, partials and helpers, and exports a function that can be used to generate files from a RAML object and user data.

JavaScript Usage

Create the generator function from an object specification. The returned object accepts two parameters, the RAML object and user package information.

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

var generate = generator({
  templates: {
    'index.js': fs.readFileSync(__dirname + '/templates/index.js.hbs')
  },
  helpers: {
    stringify: require('javascript-stringify')
  }
}) //=> [Function]

Handlebars

Inside the Handlebars templates, the RAML interface is exposed as Handlebars data.

var baseUri = {{stringify @getBaseUri}}

The user data is automatically provided as the Handlebars compile context.

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.

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

var generate = /* The generator function */

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

License

Apache License 2.0

Keywords

FAQs

Package last updated on 10 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc