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

cf-gg

v0.0.1-Alpha2

Published

Quickly load configurations from hjson files without baggage.

Downloads

12

Readme

cf-gg

Quick, easy hjson based configuration loading with some small extensions for things you might want to use those configs with.

CF-GG is still heavily under development. The core features are working well enough for me to use them, the way I use this tool is what you'll find documented here.

cf-gg is a quick, easy, simple, all of the good things- configurations loader for your systems.

It is designed for you to bring in and load configuration out the ./config directory of your project and to work with no setup.

Usage

Basic Usage

Call the module to load all hjson configuration files from a directory and populate process with them.

const cfgg = require('cf-gg')

let configObject = cfgg()

First Call of cfgg()

The first time you call cfgg it loads your configuration files from the defined directory, by default it looks into your base applications /config/ directory. It then parses any hjson it finds under that directory and any child directories into a configuration object.

Subsequent calls of cfgg() will return the configuration object itself. You cannot force the files to reload using cfgg() multiple times.

Providing Options

The module can take arguments in the form of an options object. The following options are available:

| option | type | default | behaviour | | ------- | :----------: | :---: |:----- | | loadToRoot | bool | false | If true, all configs are loaded into the root object instead of being distributed into sub-objects by directory name. | | path | string | /config/ directory relative to require.main file. | Changes the path that cf-gg looks for configurations in. This is an absolute path so use __dirname to get a different sub-directory of your project. | | bindToProcess | bool | false | If set true your configuration object can be access globally at process.cfgg.

Folder based namespaces

Originally a feature and now the default behavior. This creates parent objects for the configurations it finds based on what directory it finds them in. This way if you have many configurations or categories of them, you can create folders to organize them instead of creating more tab-levels in your documents.

If you want all of your configurations to simply go to the root level of the configuration object, provide the option loadToRoot:true to your initial cfgg() call

const cfgg = require('cf-gg')

var path = 

cfgg(__dirname + '/config/', options)

Environment Configurations

It will also handle different environment configurations if you want. Write your different environment configurations in your config/.env/ directory and provide your application with the --env [envname] argument and your configuration object will have a .env property will be set to the matching sub-configuration.