This is a simple npm module which injects the contents of the partial .yaml files into a specific property of the main .yaml file.
Let's say you have the following files:
title: "Team" players: description: "This is a soccer team."
bob: name: "Bob"
steve: name: "Steve" age: 15
This module can then generate output.yaml with the following contents:
title: "Team" players: bob: name: "Bob" steve: name: "Steve" age: 15 description: "This is a soccer team."
You can either include src/index.js in another script and call the exported function:
const yamlInject=require('yaml-inject') yamlInject(mainFilePath,partialsGlobString,outputFilePath,propertyPath)
or you can call the binary directly from the command line:
npx yaml-merge --main <mainFilePath> --partials <partialsGlobString> --output <outputFilePath> --property <propertyPath>
- mainFilePath is the path to the main YAML file
- partialsGlobString is the glob string to match the partial YAML files (e.g. 'partials/*.yml')
- outputFilePath is the path where the merged YAML file will be saved
- propertyPath is the property path in the main file where the partial YAML contents should be inserted (e.g. 'players')