Merges one or more YAML files into a base file.
mermal
is available on npmjs.com.
mermal
provides an API as well as a CLI.
# Locally
$ yarn add mermal # Using yarn
$ npm install mermal # Using npm
# Or globally
$ yarn global add mermal # Using yarn
$ npm install -g mermal # Using npm
All API methods returns with a promise.
import * as merge from 'mermal';
const base = `a:
b1: b1
b2: b2`;
const override = `a:
b1: b3
c:
d1: d1`;
merge.toYaml(base, override)
.then(console.log);
/**
* Log will read:
a:
b1: b3
b2: b2
c:
d1: d1
*/
$ mermal -b base.yaml -s sub/ -o out.yaml
-b, --base <baseFile> Path to the base YAML file where other files will be merged into
-o, --out <outFile> Path to the YAML file that will be exported to. It will override any existing files
-s, --search <searchDir> A directory that will be searched for
-h, --help output usage information
See mermal --help
for more options.
merge-yaml
- Lacks extensive testing
- Throws error if the file could not be found
- Must specify the path of every file
swagger-yaml
- Not available as a CLI
- Opinionated about where you place your source files
- Improve Tests
- More tests
- Handle edge cases