Skip to content

super-yaml is a tool that helps you write enhanced yaml's and compile them to regular YAML .yml files.

License

Notifications You must be signed in to change notification settings

doriaviram/super-yaml

Repository files navigation

super-yaml

Version Downloads/week codecov License semantic-release oclif

Intro

super-yaml is a tool that helps you write enhanced yaml's and compile them to regular yaml .yml files.

Quick demo: https://doriaviram.github.io/super-yaml/

Features

Common types

In

_types:
  MyCoolType:
    properties:
      englishName: <% Var(name) %> # Expect name parameter
      geoData:
        city: Jerusalem # Const
        country: <% Var(country,Israel) %> # Parameter with default value
      hebrewName: <% Var(name) %> # Reuse same parameter

CoolExample1<MyCoolType>:
  name: SuperYaml
CoolExample2<MyCoolType>:
  name: Syml
  country: Tel-Aviv # Is it a country ?

Out

CoolExample1:
  englishName: SuperYaml
  geoData:
    city: Jerusalem
    country: Israel
  hebrewName: SuperYaml
CoolExample2:
  englishName: Syml
  geoData:
    city: Jerusalem
    country: Tel-Aviv
  hebrewName: Syml

DRY - Imports

In

shared.syml

_types:
  MyCoolType:
    properties:
      englishName: <% Var(name) %> # Expect name parameter
      geoData:
        city: Jerusalem # Const
        country: <% Var(country,Israel) %> # Parameter with default value
      hebrewName: <% Var($.name) %> # Reuse same parameter

config.syml

_import:
  - ./shared.syml

CoolExample1<MyCoolType>:
  name: SuperYaml
CoolExample2<MyCoolType>:
  name: Syml
  country: Tel-Aviv # Is it a country ?

Out

CoolExample1:
  englishName: SuperYaml
  geoData:
    city: Jerusalem
    country: Israel
  hebrewName: SuperYaml
CoolExample2:
  englishName: Syml
  geoData:
    city: Jerusalem
    country: Tel-Aviv
  hebrewName: Syml

String templates

In

_types:
  MyCoolType:
    properties:
      englishName: Mr. <% Var(name) %>
      welcomeMessage: Mr. <% Var(name) %><% Var(name) %>, Hello
CoolExample1<MyCoolType>:
  name: SuperYaml

Out

CoolExample1:
  englishName: Mr. SuperYaml
  welcomeMessage: Mr. SuperYaml, Hello

Config

All options, which are set Available in global config? from ToastOptions are supported. Below are extra configurable options:

Name Type Default Description
typeKeyPrefix string < Set the prefix for type declaration Example1<MyCoolType>
typeKeySuffix string > Set the suffix for type declaration Example1<MyCoolType>
typeVariablePrefix string $. Set the prefix for variable $.myParam

Requirements

nodejs >= 12

Usage

$ npm install -g super-yaml
$ super-yaml COMMAND
running command...
$ super-yaml (-v|--version|version)
super-yaml/0.0.0-development darwin-x64 node-v12.9.1
$ super-yaml --help [COMMAND]
USAGE
  $ super-yaml COMMAND
...

Commands

super-yaml compile

Compile syml to simple yml

USAGE
  $ super-yaml compile

OPTIONS
  -s, --source=source                      (required)
  -t, --target=target                      (required)
  --typeKeyPrefix=typeKeyPrefix
  --typeKeySuffix=typeKeySuffix
  --typeVariablePrefix=typeVariablePrefix

EXAMPLES
  $ super-yaml compile -s config.syml -t config.yml
  $ super-yaml compile --source config.syml --target config.yml

See code: src/commands/compile.ts

super-yaml help [COMMAND]

display help for super-yaml

USAGE
  $ super-yaml help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help