Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d4nyll/mermal
Merge YAML files together
https://github.com/d4nyll/mermal
merge swagger yaml
Last synced: about 4 hours ago
JSON representation
Merge YAML files together
- Host: GitHub
- URL: https://github.com/d4nyll/mermal
- Owner: d4nyll
- Created: 2017-11-01T19:02:02.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-10T02:36:04.000Z (5 months ago)
- Last Synced: 2024-11-14T17:51:02.853Z (about 19 hours ago)
- Topics: merge, swagger, yaml
- Language: JavaScript
- Size: 923 KB
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![CI Build Status](https://github.com/d4nyll/mermal/actions/workflows/ci.yaml/badge.svg)](https://travis-ci.org/d4nyll/mermal) [![Maintainability](https://api.codeclimate.com/v1/badges/988aa7d648997b23e4f7/maintainability)](https://codeclimate.com/github/d4nyll/mermal/maintainability)
Merges one or more YAML files into a base file.
## Usage
`mermal` is available on [npmjs.com](https://www.npmjs.com/package/mermal).
`mermal` provides an API as well as a CLI.
### Install
```
# 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
```### API
All API methods returns with a promise.
#### Example
```
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
*/```
#### Available Methods
##### `toFile`
##### `toJson`
##### `toYaml`### CLI
#### Example
```
$ mermal -b base.yaml -s sub/ -o out.yaml
```#### Options
```
-b, --base Path to the base YAML file where other files will be merged into
-o, --out Path to the YAML file that will be exported to. It will override any existing files
-s, --search A directory that will be searched for
-h, --help output usage information
```See `mermal --help` for more options.
## Comparison with other packages
* [`merge-yaml`](https://github.com/skapoor/merge-yaml)
* Lacks extensive testing
* Throws error if the file could not be found
* Must specify the path of every file
* [`swagger-yaml`](https://github.com/idlerun/swagger-yaml)
* Not available as a CLI
* Opinionated about where you place your source files## TODO
* Improve Tests
* More tests
* Handle edge cases