# @qiwi/uniconfig-core

> Core uniconfig library

Latest version **3.5.5** (published 2024-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @qiwi/uniconfig-core
pnpm add @qiwi/uniconfig-core
yarn add @qiwi/uniconfig-core
bun add @qiwi/uniconfig-core
```

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.5.5 |
| Published | 2024-04-18 |
| First published | 2018-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 103.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Qiwi |
| Maintainers | antongolub, qiwibot |
| Keywords | universal config, unified config, uniconfig-core |

## Links

- npm: https://www.npmjs.com/package/@qiwi/uniconfig-core
- Repository: https://github.com/qiwi/uniconfig
- Homepage: https://github.com/qiwi/uniconfig#readme
- Issues: https://github.com/qiwi/uniconfig/issues
- npm.io page: https://npm.io/package/@qiwi/uniconfig-core

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [browser-or-node](https://npm.io/package/browser-or-node.md) ^3.0.0

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads
- [@react-md/material-icons](https://npm.io/package/@react-md/material-icons.md) — 1.6K weekly downloads

## Recent versions

- 3.5.5 (latest) — 2024-04-18
- 3.5.4 — 2022-08-09
- 3.5.3 — 2021-11-13
- 3.5.2 — 2021-09-24
- 3.5.1 — 2020-07-25
- 3.5.0 — 2020-05-28
- 3.4.0 — 2020-05-21
- 3.3.1 — 2020-05-04
- 3.3.0 — 2020-01-29
- 3.2.2 — 2019-12-29
- 3.2.1 — 2019-11-02
- 3.2.0 — 2019-09-03
- 3.1.0 — 2019-07-29
- 3.0.0 — 2019-06-22
- 2.22.2 — 2019-05-29
- … 16 more at https://npm.io/package/@qiwi/uniconfig-core/versions

## README

# @qiwi/uniconfig-core

Core uniconfig layer: basic ifaces, utils, entry point, plugin API

## Install
```bash
  npm i @qiwi/uniconfig-core
  yarn add @qiwi/uniconfig-core
```

# Plugin API
`uniconfig` features may be significantly extended with plugins.
```javascript
import uniconfig, {rollupPlugin} from '@qiwi/uniconfig-core'
import uniconfigPluginFile from '@qiwi/uniconfig-plugin-api-file'    
import uniconfigPluginYaml from '@qiwi/uniconfig-plugin-yaml'    
import uniconfigPluginDatatree from '@qiwi/uniconfig-plugin-datatree'    

rollupPlugin(uniconfigPluginFile)
rollupPlugin(uniconfigPluginYaml)
rollupPlugin(uniconfigPluginDatatree)
const config = uniconfig('./foobar.yml', {mode: 'sync', pipeline: 'file>yaml>datatree'})    
```

Each plugin should expose at least two methods to be registered: `rollup` and `rollback`.
```javascript
export interface IContext {
  pipe: IRegistry
}

export interface IPlugin {
  rollback(context: IContext): void,
  rollup(context: IContext): void
}
``` 

`IPipe` with additional `name` field is also provided as plugin declaration:
```javascript
  const name = 'test'
  const pipe = {
    handle() {},
    handleSync() {}
  }
  const pipeAsPlugin = {...pipe, name}
  
  rollupPlugin(pipeAsPlugin)
  context.pipe.get(name)  // IPipe
```

### Example
```json
{
  "data": {
    "foo": "bar",
    "baz": 1,
    "host": "$remoteConfig.hostname",
    "port": "$jsonFile.defaultPort"
  },
  "sources": {
     "jsonFile": {"pipeline": "file>json", "data": "./foo.json"},
     "yamlFile": {"pipeline": "file>yaml", "data": "./bar.yaml"},
     "remoteConfig": {"pipeline": "http>json", "data": "https://reqres.in/api/users/2"}
  }
}
```

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