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

figleaf

v1.0.0

Published

FigLeaf is an extremely lightweight config loader that allows searching of multiple paths for configurations

Downloads

145

Readme

Figleaf

Super simple, lightweight configuration loader

Why another configuration loader?

There are a lot of good configuration management packages for Node.js - such as nconf, and node-config - and I'd recommend checking some of those out to see whether they suit you.

Figleaf is designed to meet my desire for a super simple JSON configuration loader that also allows me to store my production configurations in separate location to my code base, but to not require painful amounts of environment variable setting, or not handling different machine configurations well.

Basically, Figleaf simply allows you to check for the existence of a single environment variable containing the path to your application configurations, and if that doesn't exist, then run down a list of supplied paths checking for the presence of configuration files.

If all else fails, Figleaf simply adopts the practice of looking for config files in the /config directory of the current working direction.

Usage

/** Load the config, checking first in the FIGLEAF_CONFIG environment variable, then examining the paths given, then checking the {cwd}/config director
 **/
var config = require('figleaf')({ env: 'FIGLEAF_CONFIG', paths: [__dirname + '/myconfigs']});

// Configs are cached
config = require('figleaf')();

// Force a refresh
config = require('figleaf')({ env: 'FIGLEAF_CONFIG', paths: [__dirname + '/myconfigs'], refresh: true });

// If loading Javascript configuration files, pass extension
var config = require('figleaf')({ env: 'FIGLEAF_CONFIG', paths: [__dirname + '/myconfigs'], extension: 'js' });

Configuration Files

Configuration files can be JSON or Javascript. The first file looked for will be default, which will then be extended with an environment specific configuration (if available) that matches the current value of process.env.NODE_ENV (or development if none is set)

License

MIT