open-index/open-npm huggingface dataset:
npm package: @icon-magic/config-reader
Description: Icon magic config parsing/reading/writing package.
Author: Ramitha Chitloor
Latest version: 2.8.0-beta.0

# @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)
npm package: @icon-magic/icon-models
Description: Icon magic provides classes for the icon and iconSet
Author: Ramitha Chitloor
Latest version: 2.8.0-beta.0

# @icon-magic/icon-models

This is the core of @icon-magic as it contains all the classes for that
represent the icon and a set of icons.

- defining the Icon and IconSet interfaces
- exposing a class that manipulates the icon in memory
- provides plugin-manager functions that apply plugins on the icon
- provides utils for writing the icon and it's config to disk

## Interface

### Asset

Abstracts the smallest set of information that pertains to an asset file in
memory. Primary, it's path, name and contents, if it's already read into memory

### Flavor

In it's simplist definition, a Flavor is an Asset with types. This class
contains Assets for all the different types in which it can exist For example, a
Flavor consists of it's source svg as well as paths to it's png and webp assets

### Icon

Encapsulates what an Icon means. An Icon is referenced by a path to it's
directory and this directory can be assumed to contain all the different
variants and flavors in which the icon is available, in all of it's different
types(extensions). The config itself is generally more concise and human
readable but this class supplements it by providing methods on it and filling in
the gaps where they don't exist

### Icon Set

Encapsulates a set of icons and consists of a mapping of the directory to the
icon bundle and the Icon class associated with that icon

### Plugin-runner

Plugin runner is responsible for consecutively iterating through different
properties of the config file, such as variants/flavors and applying the list of
plugins on each variant/flavor If a plugin has more than one prop, then it
results in multiple files, one for each combinations of props. Else, one input
file will result in one output file. eg: P1 has [T1, T2] and runs on A.svg =>
A-T1.svg and A-T2.svg P2 has one theme - [theme1], then the result will still be
A-T1.svg and A-T2.svg the hyphenated theme name gets added only if there is more
than one theme for a plugin
npm package: @icon-magic/logger
Description: Icon magic logger package.
Author: Ramitha Chitloor
Latest version: 2.3.0-beta.0

# @icon-magic/logger

---

This package is responsible for exposing all the logging functionality for
icon-magic. It contains a wrapper around winston.js for including the filename
from where the logs are generated as a label in the logged message.

Logs are written to the following simulataneously:

1. console - logs of all levels
2. icon-magic-run.log - logs of all levels
3. icon-magic-error.log - only error logs

## Usage

```ts
// Import the logger module and it's interface
import { Logger } from "@icon-magic/logger";

// Instantiate by passing the name of the file. This will be a label in the log message
const LOGGER: logger = new Logger("icon-magic:icon-models:asset");

// Log a debug message
LOGGER.debug("Icon generation has begun");

// Log an error message
LOGGER.error("Oh no! An error has occurred!");
```

This will print logs of the following format:

```
<timestamp> [<label>] <logLevel> <msg>
```

For example,

```
2019-05-15T17:40:40.056Z [icon-magic:icon-models:asset] debug: Asset test created in /Users/rchitloo/workspace/artdeco-icons-source_trunk/icons/shadows
2019-05-15T17:40:40.060Z [icon-magic:icon-models:asset] debug: Asset creatingError created in /Users/rchitloo/workspace/artdeco-icons-source_trunk/icons/shadows
2019-05-15T17:40:40.060Z [icon-magic:icon-models:icon] error: MissingVariantError: Variant /Users/rchitloo/workspace/artdeco-icons-source_trunk/icons/shadows/creatingError.svg missing for icon /Users/rchitloo/workspace/artdeco-icons-source_trunk/icons/shadows
```

## Methods

The `logger` object exposes the following methods from `winston.logger`

- debug()
- info()
- error()
npm package: @icon-magic/timing
Description: Icon magic timing package.
Author: Omayeli Arenyeka
Latest version: 2.0.1-beta.0

# @icon-magic/timing

This package handles timing using Node.js' [process.hrtime](https://nodejs.org/api/process.html#process_process_hrtime) function.

## Usage

```ts
// Import the timing module module
import { timer } from '@icon-magic/timing';

const TIMER = timer();

function doSomething() {
  TIMER.start();
  /* Something is getting done */
  LOGGER.info(`${TIMER.end()}`);
}
```

## Methods

The `timer` object has the following methods:

To start the timer:

- start()

To end the timer, returns elapsed time:

- end()