All Projects → antonk52 → Lilconfig

antonk52 / Lilconfig

Zero-dependency nodejs config seeker.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Lilconfig

Config Rs
⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Stars: ✭ 915 (+2514.29%)
Mutual labels:  config, configuration
Jsonnet
Jsonnet - The data templating language
Stars: ✭ 5,257 (+14920%)
Mutual labels:  config, configuration
Centraldogma
Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2
Stars: ✭ 378 (+980%)
Mutual labels:  config, configuration
Configuron
Clojure(Script) config that reloads from project.clj when in dev mode
Stars: ✭ 24 (-31.43%)
Mutual labels:  config, configuration
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (+1737.14%)
Mutual labels:  config, configuration
V2ray Step By Step
This repo is a fork of ToutyRater/v2ray-guide, we aim to provide a new step-by-step guide of v2ray
Stars: ✭ 341 (+874.29%)
Mutual labels:  config, configuration
Easy Wg Quick
Creates Wireguard configuration for hub and peers with ease
Stars: ✭ 502 (+1334.29%)
Mutual labels:  config, configuration
Charles-Proxy-Mobile-Guide
The mobile hackers' guide to Charles Proxy 👍
Stars: ✭ 105 (+200%)
Mutual labels:  config, configuration
Xxl Conf
A lightweight distributed configuration management platform. (分布式配置管理平台XXL-CONF)
Stars: ✭ 619 (+1668.57%)
Mutual labels:  config, configuration
Konfig
Composable, observable and performant config handling for Go for the distributed processing era
Stars: ✭ 597 (+1605.71%)
Mutual labels:  config, configuration
Config
The Config component helps you find, load, combine, autofill and validate configuration values of any kind, whatever their source may be (YAML, XML, INI files, or for instance a database).
Stars: ✭ 3,671 (+10388.57%)
Mutual labels:  config, configuration
V2ray Examples
v2ray-core 的模板们
Stars: ✭ 778 (+2122.86%)
Mutual labels:  config, configuration
Hoplite
A boilerplate-free library for loading configuration files as data classes in Kotlin
Stars: ✭ 322 (+820%)
Mutual labels:  config, configuration
Ec 471g
黑苹果配置 hackintosh dsdt clover v3489 e1 471g ec 471g v3 471g acer mac osx efi ssdt aml config plist hd4000 gt630m inter
Stars: ✭ 30 (-14.29%)
Mutual labels:  config, configuration
goconfig
.gitconfig syntax parser
Stars: ✭ 15 (-57.14%)
Mutual labels:  config, configuration
Koanf
Light weight, extensible configuration management library for Go. Built in support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.
Stars: ✭ 450 (+1185.71%)
Mutual labels:  config, configuration
environment
🌳 Environment variable configuration for Node.js made easy.
Stars: ✭ 12 (-65.71%)
Mutual labels:  config, configuration
nest-typed-config
Intuitive, type-safe configuration module for Nest framework ✨
Stars: ✭ 47 (+34.29%)
Mutual labels:  config, configuration
Go Config
A dynamic config framework
Stars: ✭ 595 (+1600%)
Mutual labels:  config, configuration
Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+2068.57%)
Mutual labels:  config, configuration

Lilconfig ⚙️

npm version install size Coverage Status

A zero-dependency alternative to cosmiconfig with the same API.

Installation

npm install lilconfig

Usage

import {lilconfig, lilconfigSync} from 'lilconfig';

// all keys are optional
const options = {
    stopDir: '/Users/you/some/dir',
    searchPlaces: ['package.json', 'myapp.conf.js'],
    ignoreEmptySearchPlaces: false
}

lilconfig(
    'myapp',
    options // optional
).search() // Promise<LilconfigResult>

lilconfigSync(
    'myapp',
    options // optional
).load(pathToConfig) // LilconfigResult

/**
 * LilconfigResult
 * {
 *   config: any; // your config
 *   filepath: string;
 * }
 */

Difference to cosmiconfig

Lilconfig does not intend to be 100% compatible with cosmiconfig but tries to mimic it where possible. The key differences are:

  • no support for yaml files out of the box(lilconfig attempts to parse files with no extension as JSON instead of YAML). You can still add the support for YAML files by providing a loader, see an example below.
  • no cache

Options difference between the two.

cosmiconfig option lilconfig
cache
loaders
ignoreEmptySearchPlaces
packageProp
searchPlaces
stopDir
transform

Loaders example

If you need the YAML support you can provide your own loader

import {lilconig} from 'lilconfig';
import yaml from 'yaml';

const options = {
    loaders: {
        '.yaml': (filepath, content) => {
            return yaml.parse(content);
        },
        // loader for files with no extension
        noExt: (filepath, content) => {
            return yaml.parse(content);
        }
    }
};

lilconfig('myapp', options)
    .search()
    .then(result => {
        result // {config, filepath}
    });

Version correlation

  • lilconig v1 → cosmiconfig v6
  • lilconig v2 → cosmiconfig v7
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].