super-yaml
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

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/1.2.4 linux-x64 node-v14.18.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
  --typeVariableSuffix=typeVariableSuffix

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

Readme

Keywords

Package Sidebar

Install

npm i super-yaml

Weekly Downloads

3

Version

1.2.4

License

MIT

Unpacked Size

32.1 kB

Total Files

44

Last publish

Collaborators

  • doriaviram