# config-yaml

> YAML configuration for NodeJS

Latest version **1.1.6** (published 2020-07-20) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2020-07-20 |
| First published | 2016-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/config-yaml) |
| Module format | CommonJS |
| Node | >= 5 |
| Dependencies | 2 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | neolao |
| Maintainers | neolao |

## Links

- npm: https://www.npmjs.com/package/config-yaml
- Repository: https://github.com/neolao/config-yaml
- Homepage: https://github.com/neolao/config-yaml#readme
- Issues: https://github.com/neolao/config-yaml/issues
- npm.io page: https://npm.io/package/config-yaml

## Dependencies (2)

- [js-yaml](https://npm.io/package/js-yaml.md) ^3.14.0
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.2.2

## Recent versions

- 1.1.6 (latest) — 2020-07-20
- 1.1.5 — 2020-07-19
- 1.1.4 — 2020-03-14
- 1.1.3 — 2020-01-02
- 1.1.2 — 2019-12-31
- 1.1.1 — 2018-05-21
- 1.1.0 — 2018-05-18
- 1.0.6 — 2017-06-02
- 1.0.5 — 2017-06-01
- 1.0.4 — 2016-09-02
- 1.0.3 — 2016-09-02
- 1.0.2 — 2016-08-31
- 1.0.1 — 2016-08-31
- 1.0.0 — 2016-08-31

## README

![Node version](https://img.shields.io/node/v/config-yaml.svg)
![Version](https://img.shields.io/npm/v/config-yaml.svg)
[![Build status](https://travis-ci.org/neolao/config-yaml.svg)](https://travis-ci.org/neolao/config-yaml)
[![dependencies Status](https://david-dm.org/neolao/config-yaml/status.svg)](https://david-dm.org/neolao/config-yaml)
[![devDependencies Status](https://david-dm.org/neolao/config-yaml/dev-status.svg)](https://david-dm.org/neolao/config-yaml?type=dev)

config-yaml
===========

YAML configuration for NodeJS


Basic example
-------------

`config/default.yml`:

```yaml
foo: "bar"
list:
    - 1
    - 2
    - 3
```

```javascript
import configYaml from "config-yaml";

const config = configYaml(`${__dirname}/config/default.yml`);

console.log(config.foo); // "bar"
console.log(config.list[1]); // 2
```

Example with `imports` directive
--------------------------------

`config/production.yml`:

```yaml
imports:
    - { resource: "default.yml" }
    - { resource: "routing/api.yml", property: "routing.api" }

foo: "hello"
tic: "tac"
```

```javascript
import configYaml from "config-yaml";

const config = configYaml(`${__dirname}/config/production.yml`);

console.log(config.foo); // "hello"
console.log(config.routing.api); // Configuration from routing/api.yml
```

Available variables
-------------------

| Variable       | Description                             |
| -------------- | --------------------------------------- |
| `%__dirname%`  | Directory path of the current YAML file |
| `%__filename%` | Current YAML file path                  |

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