# yaml-files

> Include multiple yaml files in another yaml file for js-yaml.

Latest version **1.1.0** (published 2018-08-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install yaml-files
pnpm add yaml-files
yarn add yaml-files
bun add yaml-files
```

Provides the command `yaml-files`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-08-15 |
| First published | 2017-11-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 6 |
| Unpacked size | 258.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | scisco |
| Maintainers | scisco |
| Keywords | yaml, files, js-yaml |

## Links

- npm: https://www.npmjs.com/package/yaml-files
- Repository: https://github.com/scisco/yaml-files
- Issues: https://github.com/scisco/yaml-files/issues
- npm.io page: https://npm.io/package/yaml-files

## Dependencies (6)

- [js-yaml](https://npm.io/package/js-yaml.md) ^3.6.1
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [cliclopts](https://npm.io/package/cliclopts.md) ^1.1.1
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.0
- [lodash.isarray](https://npm.io/package/lodash.isarray.md) ^4.0.0
- [lodash.mergewith](https://npm.io/package/lodash.mergewith.md) ^4.6.1

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-08-15
- 1.0.1 — 2018-08-15
- 1.0.0 — 2018-08-15
- 0.1.0 — 2017-11-09

## README

# yaml-include

[![CircleCI](https://circleci.com/gh/scisco/yaml-files.svg?style=svg)](https://circleci.com/gh/scisco/yaml-files)
[![npm version](https://badge.fury.io/js/yaml%2dfiles.svg)](https://badge.fury.io/js/yaml%2dfiles)


Adds a custom tag for a [YAML](http://yaml.org/) document that facilitate inclusion and merging of external `.yaml` files.

## Installation

      $ npm install yaml-files

## CLI Usage

```bash
$ 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`
```yaml
key1: my key in file1
array:
  - array1
```

`file2.yml`
```yaml
key2: my key in file2
array:
  - array2
```

`main.yml`
```yaml
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`
```yaml
key1: my key in file1
array:
  - array1
```

`file2.yml`
```yaml
key2: my key in file2
array:
  - array2
```

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

`index.js`
```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 

- [yaml-include](https://github.com/claylo/yaml-include)

---
_Source: https://npm.io/package/yaml-files · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
