Socket
Socket
Sign inDemoInstall

raml-generator

Package Overview
Dependencies
Maintainers
3
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 template functions


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

RAML Generator

Greenkeeper badge

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

Keywords

FAQs

Package last updated on 14 May 2018

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