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 🙏

© 2025 – Pkg Stats / Ryan Hefner

rsjs-config

v1.0.4

Published

rsjs config

Downloads

4

Readme

rsjs-config

build status codacy coverage dependencies npm Greenkeeper badge

Requirements

The config files have to be in a dedicated folder, but the location of this folder and its name are up to you.

This dedicated folder cannot have any subfolders except one optional folder which has to be called env. This _ optional_ env folder can only contain environment specific overrides, like development, stage, production or any other environment value you may set NODE_ENV to be.

The config files can be either .ts, .js or .json files. And they can also be mixed, if you want to play like that.

The .json files have to contain a pure json object with configurations.

The .ts and .js should export the json config:

module.exports = {
	...
}

The names of config files are used as the config root keys.

Optional .env file

Optionally, you can also use a .env file with secret overrides, which you can also name as you wish. This file should not be commited to your repository and is normally used for passwords. Standard files are .env , .env,local, .local and so on.

This file requires a namespace word that will be used as the prefix for every config value in it.

For example, if we want to define the foo.pwd value, and we decided to use blah as our namespace, then .env file would have:

blah.foo.pwd = "verysecretpwd"

Usage

Let's say our project is structured as follows:

├─── main.js
├─── config
│   ├─── env
│   │   ├─── stage.js
│   │   └─── production.js
│   ├─── one.js
│   └─── two.js
├─── .env

Then, in one.js we can have keys foo and bar, with some content. In two.js we can have keys goo and car, with some content.

In stage.js we have foo.dburl for the stage environment database. In production.js we have foo.dburl for the production environment database.

Finally, in .env we have blah.foo.pwd for the database password. This file has to exist in each environment and contain different environment values.

Then, this is how we initiate the RsConfig instance, in main.js:

// main.js
const path = require("path");
const RsConfig = require("rsjs-config");

RsConfig.init(path.join(__dirname, 'config'), {
	file: path.join(__dirname, '.env'),
	word: 'blah'
});
const dburl = RsConfig.get('one.foo.dburl');
...

Documentation

TypeDoc documentation