@leebmann24/recursive-yaml-loader
v1.1.2
Published
recursively loads yaml files from a given folder and it's subfolders. After that it merges everything into a single json object which will be returned.
Downloads
5
Readme
@leebmann24/recursive-yaml-loader
loads yaml files recursively from a given folder. properties are grouped by it's filename (without extension) or foldername With this tool you are able to split up your configuration yamls into several files for clearity and maintainability.
install
$ npm install @leebmann24/recursive-yaml-loader
or
$ yarn add @leebmann24/recursive-yaml-loader
example
import loader from '@leebmann24/recursive-yaml-loader'
interface Config {
file1: {
property1: string
list: string[]
}
aFolder: {
file: string[]
}
}
const config = loader.load('path/to/config/folder') as Config
parent/child combination
a file with the same name as the folder in which it's in will be merged into its "parent"
- propXY (folder)
- propXY.yml (will NOT be encapsulated)
- hello: "world"
- anotherProp.yml (will be encapsulated)
- abc: "xyz"
- propXY.yml (will NOT be encapsulated)
{
"propXY": {
"hello": "world",
"anotherProp": {
"abc": "xyz"
}
}
}