1.0.0 • Published 2 years ago

@model-w/hydroyaml v1.0.0

Weekly downloads
-
License
WTFPL
Repository
github
Last release
2 years ago

Hydroyaml The YAML of the gods

Hydroyaml is a templating engine for YAML files. It is kind of inspired by what Ansible allows you to do, but implemented in Node with powering GitHub Actions in mind.

For example you can have a YAML file like this:

services:
    foo: # my foo service
        image:
            "my-registry.com/{{ .foo.project }}/{{ .foo.name }}:{{ .foo.tag }}"
        environment:
            DOCKER_IMAGE: "{{ services.foo.image }}"

Then you do this:

import hydroyaml, { fromFile } from "hydroyaml";

const rendered = await hydroyaml(fromFile("my-template.yml"), {
    foo: {
        project: "my-project",
        name: "my-service",
        tag: "latest",
    },
});

And rendered will contain:

services:
    foo: # my foo service
        image: my-registry.com/my-project/my-service:latest
        environment:
            DOCKER_IMAGE: my-registry.com/my-project/my-service:latest
1.0.0

2 years ago