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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@microparts/configuration-js

v1.1.0

Published

Configuration module for microservices written on TypeScript. Specially created for follow up corporate standards of application configuration.

Readme

Javascript microservice configuration library

Build Status

Production-ready configuration for microservices. Written in TypeScript. Library works with nodejs apps and with browsers*.

Library created for follow up corporate standards of application configuration.

Installation

npm install --save @microparts/configuration-js
// or
yarn add @microparts/configuration-js

Usage

By default path to configuration directory and application stage loading from /app/configuration with local stage.

  1. Simple
import { Configuration } from '@microparts/configuration-js';

const conf = new Configuration();
conf.load();

console.log(conf.all()); // get all config
console.log(conf.get('foo.bar')); // get nested key use dot notation
  1. If u would like override default values, you can pass 2 arguments to class constructor or set up use setters.
import { Configuration } from '@microparts/configuration-js';

const conf = new Configuration('./configuration', 'test');
// or
// conf.path = './configs';
// conf.stage = 'local';
conf.load();

conf.get('foo'); // full example on the top
  1. If the operating system has an env variables CONFIG_PATH and STAGE, then values for the package will be taken from there.
export CONFIG_PATH=/configuration
export STAGE=prod
import { Configuration } from '@microparts/configuration-js';

const conf = new Configuration('./configuration', 'test');
conf.load(); // loaded files from /configuration for prod stage.

conf.get('foo'); // full example on the top
  1. If u want to see logs and see how load process working, pass you logger to property:

Pass it like this:

import { Configuration, StdoutConsoleLogger } from '@microparts/configuration-js';

const conf = new Configuration();
conf.logger = new StdoutConsoleLogger();
conf.load();

conf.get('foo'); // full example on the top

Or if you would like use external logger, like Winston, you can integrate it with LoggerInterface. Just a write the adapter like as WinstonConsoleLogger.

For now, by default library support one Winston transport called Console. Okay, let's go use adapter for him...

First, install logger:

npm install --save winston
// or yarn add winston

Second, pass you logger to property like this:

import { Configuration, WinstonConsoleLogger, StdoutConsoleLogger } from '@microparts/configuration-js';

const conf = new Configuration();
conf.logger = new WinstonConsoleLogger(winston.createLogger({
  transports: [new winston.transports.Console()]
}));

conf.load();

conf.get('foo'); // get value of `foo`

How to usage library with SPA apps?

Note: https://github.com/microparts/static-server-php is required for usage on the server/cloud.

For most cases, this Dockerfile can help your application build's in the cloud.

It simple. Step by step:

  1. Create an vue app for example
vue create vue-app
  1. Install this package
npm install --save @microparts/configuration-js
  1. Put config files like this
  2. Change vue.config.js to build final config to global variables:
const { Configuration, StdoutConsoleLogger } = require('@microparts/configuration-js');

module.exports = {
  lintOnSave: false,
  chainWebpack: config => {
    config.plugin('html').tap(options => {
      const conf = new Configuration('./configuration');
      conf.logger = new StdoutConsoleLogger(); // new StdoutConsoleLogger(true); // for debug
      conf.load();

      options[0].__config = conf.asEscapedJson();
      options[0].__stage = conf.stage;

      return options;
    });
  }
};
  1. Add following code to index.html to top of <head> html tag (before all scripts):
<head>
  <% if (htmlWebpackPlugin.options.__stage === 'local') { %>
    <script>
      window.__config = JSON.parse("<%= htmlWebpackPlugin.options.__config %>");
      window.__stage = '<%= htmlWebpackPlugin.options.__stage %>';
      window.__vcs = '';
    </script>
  <% } %>
<!-- ... meta tags and other code -->
  1. Add globals to .eslintrc:
"globals": {
  "__config": "readonly",
  "__stage": "readonly",
  "__vcs": "readonly"
 },
  1. Run application.
npm run serve

Full example available at here.

License

The MIT License

Copyright © 2020 spacetab.io, Inc. https://spacetab.io

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.