npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ufp-lcars-config

v1.0.0

Published

LCARS configuration module

Downloads

2

Readme

ufp-lcars-config

This module is responsible for loading configuration from various sources and then combining them into a single runtime configuration.

examples

Two example "validator" objects exist: validators/allFeatures.js & validators/lcars.js.

The validators/lcars.js is intended to be used/extended by the main ufp-lcars project for which this module was created.

Executing the following code will:

  1. Load files beginning with the name ".name" from the source code's directory, the user's home, and the current working directory.
  2. After doing this it will map any config parameters detected in environment varibles; it will search for the values using environment variable names defined by a keyified sanitizers in a very specific order: for example with "knex.connection.filename" `export knex.connection.filename="one.db"; export KNEX_CONNECTION_FILENAME="two.db"; ./example/bin
  3. "UNIX_LIKE_CAPS_AND_UNDERSCORE"

API

Table of Contents

environment

Maps environment variables to "config" obj.

Parameters

  • validators Object An ideal config tree of functions that validato & validate values.
  • env Object Environment variables as key/value.

Returns Object A configuration object with only settings from the environment present.

files

Parameters

  • validators
  • paths Array Array of string locations to search for ".lcars.js" & ".lcars-environment.js" configuration files.
  • fileNames
  • idealized Object config property tree with optional functions to validate/sanitize values.

Returns Object technically only the config specified; but since this is where defaults arise it'll be everything really.

options

Parameters

  • validators
  • argv {Array} Array of strings to be interpreted as options; process.argv without slicing 2 is fine & dealt with.

Returns Object Configration map of only options specified from command line.

unknown

boolean: [ "interactive", "terminal", "secure", "knex.debug", "secret" ],

Parameters

  • option

runtime

This constructs a singular configure object from the various sources.

Parameters

  • validators Object A tree of functions that define all keys; sanitize key values; and throw runtime errors on invalid key values.
  • argv Array Array of strings, it's fine to include the first elements of process.argv.
  • env Object Environment variables represented as a POJO
  • paths Array Array of strings that are paths to be searched for configuration.
  • fileNames Array Array of strings that are base names of files to be searched.

Returns object configuration object that is a mapped combination of these diverse sources.

validatorsToblank

Always returns an empty skeleton of a validators tree.

Parameters

  • validators

Returns Object configuration object