JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 43449462
  • Score
    100M100P100Q224291F
  • License MIT

A tiny replacement to cosmiconfig

Package Exports

  • lilconfig

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lilconfig) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Lilconfig ⚙️

npm version install size

A tiny replacement for cosmiconfig with similar 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.config.js'],
    ignoreEmptySearchPlaces: true
}

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

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

/*
 * LilconfigResult
 * {
 *   config: any; // your config
 *   path: 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:

  • not support yaml files out of the box(lilconfig attempts to parse files with no extension as JSON files instead of YAML)
  • no cache

Options difference between the two.

cosmiconfig option name lilconfig
cache
loaders
ignoreEmptySearchPlaces
packageProp
searchPlaces
stopDir
transform