yaml-files
Include multiple yaml files in another yaml file for js-yaml.
Last updated 2 years ago by scisco .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install yaml-files 
SYNC missed versions from official npm registry.

yaml-include

CircleCI npm version

Adds a custom tag for a YAML document that facilitate inclusion and merging of external .yaml files.

Installation

  $ npm install yaml-files

CLI Usage

$ npm install -g yaml-files
$ yaml-files -h
Usage: yaml-files <input_filename> <output_filename> [options]
  input_filename:       path to yml file being parsed
  output_filename:      path to save the yml file
    --help, -h            show help

Library Usage

Merge

Merge multiple yaml files with lodash merge.

file1.yml

key1: my key in file1
array:
  - array1

file2.yml

key2: my key in file2
array:
  - array2

main.yml

myDocument:
  key1: myKey
  key2: !!files_merge ['file1.yml', 'file2.yml']

Merge with Append

Merge multiple yaml files with lodash merge with arrays appended

file1.yml

key1: my key in file1
array:
  - array1

file2.yml

key2: my key in file2
array:
  - array2

main.yml

myDocument:
  key1: myKey
  key2: !!files_merge_append ['file1.yml', 'file2.yml']

index.js

const yaml = require('js-yaml');
const yamlfiles = require('yaml-files');
const fs = require('fs');

const src = fs.readFileSync('main.yml', 'utf8');

const obj = yaml.load(src, { schema: yamlfiles.YAML_FILES_SCHEMA });

Based On

Current Tags

  • 1.1.0                                ...           latest (2 years ago)

4 Versions

  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (6)
Dev Dependencies (8)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |