0.4.0 • Published 4 months ago

@jil/config v0.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

@jil/config

Powerful convention based finder, loader, and manager of both configuration and ignore files.

import {Blueprint, Schemas} from '@jil/common/optimal';
import {Configuration} from '@jil/config';

interface ConfigFile {
  debug: boolean;
  sourceMaps: boolean;
}

class ConfigManager extends Configuration<ConfigFile> {
  blueprint({bool}: Schemas): Blueprint<ConfigFile> {
    return {
      debug: bool(),
      sourceMaps: bool(),
    };
  }
}

const configManager = new ConfigManager('jil');

// Load `.config/jil.js`, `jil.production.json`, `.jil.yaml`, etc
const {config} = await configManager.loadConfigFromRoot('.');

// Load `.jilignore` files
const ignore = await configManager.loadIgnoreFromBranchToRoot('./some/deep/path');

Features

  • Loads root configs (.config/<name>.js) and branch configs (.<name>.js).
  • Loads ignore files (.<name>ignore).
  • Supports multiple config types: js, cjs, mjs, json, yaml
  • Supports environment and root-level based overrides.
  • Supports extending from other config files.
  • Find files within each branch folder while traversing up the tree.
  • Caches finder results for increased efficiency.
  • Custom key-value setting processors.

Installation

npm i @jil/config

Documentation

0.4.0

4 months ago

0.3.18

7 months ago

0.3.17

11 months ago

0.3.16

1 year ago

0.3.15

1 year ago

0.3.14

1 year ago

0.3.13

1 year ago

0.3.12

1 year ago

0.3.11

2 years ago

0.3.10

2 years ago

0.3.9

2 years ago

0.3.0

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago