0.0.2 • Published 1 year ago

confique v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Confique

A simple configuration loader with TypeScript and ESM support out of the box

NPM version

  • Search and load configuration
  • Good defaults or customise to your needs
  • TypeScript and ESM support out of the box
  • Define order of precedence

Will load the files in the following order by default, for a library called banjo:

  • package.json
  • .rc files (.banjorc, .banjorc.ts, .banjorc.js, .banjorc.cjs, .banjorc.mjs, .banjorc.json, .banjorc.yaml, .banjorc.yml)
  • config files (banjo.config.ts, banjo.config.js, banjo.config.cjs, banjo.config.mjs, banjo.config.json, banjo.config.yaml, banjo.config.yml)

Installation

npm install confique

Usage

import { confique } from "confique";

// different ways to configure
const confiq = confique("libraryName");
const confiq = confique("libraryName", { preferOrder: ["js", "ts"] });
const confiq = confique("libraryName", { searchPaths: ["fileName.ts", "fileName.js"] });
const confiq = confique("libraryName", { module: "config" });

// search for all possible files
const loaded = await confiq.search();

// load a specific file
const loaded = await confiq.load("path/to/config.ts");
0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago