# @icon-magic/config-reader

> Icon magic config parsing/reading/writing package.

Latest version **2.8.0-beta.0** (published 2022-02-17) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install @icon-magic/config-reader
pnpm add @icon-magic/config-reader
yarn add @icon-magic/config-reader
bun add @icon-magic/config-reader
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.8.0-beta.0 |
| Published | 2022-02-17 |
| First published | 2019-07-31 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 101.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ramitha Chitloor |
| Maintainers | thegilby, camario25, epicmiller, rchitloor, omayeli |

## Links

- npm: https://www.npmjs.com/package/@icon-magic/config-reader
- npm.io page: https://npm.io/package/@icon-magic/config-reader

## Dependencies (6)

- [ajv](https://npm.io/package/ajv.md) ^6.9.2
- [glob](https://npm.io/package/glob.md) ^7.1.3
- [@types/glob](https://npm.io/package/@types/glob.md) ^7.1.1
- [import-fresh](https://npm.io/package/import-fresh.md) ^3.0.0
- [@icon-magic/logger](https://npm.io/package/@icon-magic/logger.md) ^2.3.0-beta.0
- [@icon-magic/icon-models](https://npm.io/package/@icon-magic/icon-models.md) ^2.8.0-beta.0

## Recent versions

- 2.8.0-beta.0 (latest) — 2022-02-17
- 2.7.0-beta.0 (beta) — 2021-12-22
- 2.6.0-beta.0 — 2021-12-17
- 2.5.0-beta.0 — 2021-11-03
- 2.4.1-beta.0 — 2021-10-12
- 2.4.0-beta.0 — 2021-10-08
- 2.3.0-beta.0 — 2021-07-27
- 2.2.9-beta.0 — 2021-07-14
- 2.2.8-beta.0 — 2021-05-04
- 2.2.1-beta.0 — 2019-10-14
- 2.2.0-beta.0 — 2019-09-16
- 2.0.1-beta.0 — 2019-07-31

## README

# @icon-magic/config-reader

This module is responsible for finding the closest config
file(iconrc.json/iconrc.js/icon) to an icon and resolving all the paths in the
config file so it's relative to the icon bundle. It helps in

- Locating config files within directories
- Provides utils to read, validate and write icon config files
- Defining and managing the data for each icon
- Managing the config data for a set of icons in memory via a hash

## Interface

### getIconConfigSet(inputPaths: string[]): IconConfigHash

This is the primary method that the bundle exposes and is responsible for taking
a set of input paths and constructing a map of the path to the icon and it's
corresponding config JSON that should, entirely represent the characteristics of
the icon. It validates the structure of all the configs as well.

An example input iconrc.json looks like this. Refer to
@icon-magic/config-reader/schemas/config-schema for a detailed description of
the various fields

```typescript
{
  "iconPath": "*",
  "variants": [
    {
      "path": "./filled.svg"
    },
    {
      "name": "someOtherName",
      "path": "./outline.svg"
    }
  ],
  "sizes": [24],
  "resolutions": [1],
  "build": {
    "outputPath": "./out"
  },
  "generate": {
    "outputPath": "./out",
    "types": [
      {
        "name": "svg",
        "plugins": []
      },
      {
        "name": "raster",
        "plugins": []
      }
    ]
  }
}

```

For more details on the interfaces, refer to [@icon-magic/icon-models](../icon-models/README.md)

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