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

spur-config

v2.0.6

Published

Configuration framework to help manage complex application configurations in Node.js.

Downloads

2,258

Readme

Configuration framework to help manage complex application configurations in Node.js.

NPM Version NPM Install Size NPM Downloads

About the Spur Framework

The Spur Framework is a collection of commonly used Node.JS libraries used to create common application types with shared libraries.

Visit NPMJS.org for a full list of Spur Framework libraries >>

Topics

Quick start

Installing

Standalone:

$ npm install spur-config --save

With dependency injection:

$ npm install spur-ioc --save
$ npm install spur-common --save
$ npm install spur-config --save

Usage

Supports active Node versions in the LTS Schedule. (view current versions)

Configuration files

src/config/default.js

module.exports = function () {

  return this.properties({
    environment: 'default',
    port: 8080
  });

}

src/config/shared-deployed.js

module.exports = function () {

  return this.properties({
    shared: {
      someProp: 123
    }
  });

}

src/config/development.js (default)

module.exports = function () {

  this.extends('default');

  return this.properties({
    environment: 'default'
  });

}

src/config/production.js

module.exports = function () {

  // Extend multiple files
  this.extends('default', 'shared-deployed');

  return this.properties({
    environment: 'production',
    port: process.env.PORT or 9000
  });

}

Standalone use

This example shows how to manually load configuration into

const spurConfig = require('spur-config');

const configDirectory = path.join(__dirname, 'src/config');

// load specific environment file
const config = SpurConfig.load(configDirectory, 'production');

// loads configuration specified in NODE_ENV environment variable
const config = SpurConfig.load(configDirectory);

With spur-ioc auto-registration

This example loads the configuration into an injector/module and makes it available as the config dependency.

src/injector.js

const spur = require('spur-ioc');
const spurConfig = require('spur-config');
const registerConfig = require('spur-common/registerConfig');

module.exports = function () {

  const ioc = spur.create('test-application');
  const configDirectory = path.join(__dirname, './config');

  registerConfig(ioc, configDirectory);

  return ioc;
}

src/services/TestConfig.js

module.exports = function (config) {

  console.log(config);

}

Contributing

We accept pull requests

Please send in pull requests and they will be reviewed in a timely manner. Please review this generic guide to submitting a good pull requests. The only things we ask in addition are the following:

  • Please submit small pull requests
  • Provide a good description of the changes
  • Code changes must include tests
  • Be nice to each other in comments. :innocent:

Style guide

The majority of the settings are controlled using an EditorConfig configuration file. To use it please download a plugin for your editor of choice.

In addition we use ESLint to enforce some of the JavaScript rules. To enable on your editor, please install one of the editor plugins.

If your editor does not have ESLint integration, the test commands below will run them and fail your build.

All tests should pass

Execute the following the install the dependencies, build and test with the following.

$ npm install
$ npm test

View the package.json's scripts section for a list of all the other commands.

License

MIT