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

@fulminate/fulminate-config-builder

v1.2.0

Published

Simple tool for working with configuration files containing sensitive information.

Downloads

33

Readme

Fulminate Config Builder

FCB simplifies the process of handling sensitive data required by software and shared among coders via git.

The idea originated from the way Symfony handles parameters.yml and parameters.yml.dist files.

Installation

npm install --save @fulminate/fulminate-config-builder

After the package was successfully installed, it is required to run the following script once to simplify usage of FCB:

node ./node_modules/@fulminate/fulminate-config-builder/prepare.js

It will first ask you if you want to make changes to ignore files (currently, only .gitignore is supported).

You can provide js or ts as a parameter. If no parameter was provided, the script will prompt for preferred type of dist file (TypeScript or JavaScript).

Usage

In the root directory of your project you will find config.ts.dist or config.js.dist file (depending on the preference you'd stated).

config.ts.dist

// Add config fields here if you need them in your config.ts file
// Comments may be given at new lines and begin with "//" or "/*"

You can populate this file line by line in the following manner:

...

db.host:localhost
db.name:database
db.username:root
db.password:root

// App settings:

app.domain:example.com

// API keys:

googleMapsAPIKey:AIza

=========================================================================

You can use //, /* or simply / to indicate comments that should be ignored by runner. Empty lines will also be ignored.

The first part of the line is the property of config object. If it has a . the first part will be assumed as child of config while the second one will be a property of the child object, e.g.:

config.ts.dist
app

db.host
config.ts
{
  "app": "YOUR_VALUE",
  "db": {
    "host": "YOUR_VALUE"
  }
}

The value that goes after : is optional and provides default value for the property and automatically applies if no other input is given by the user.

After you've done all the preparations, simply run

npm run ifc

that was automatically injected to your package.json by the preparation script.

What the runner does is:

  • Create config.ts in the root folder of your project
  • Analyse your config.ts.dist
  • Prompt for input for each line of config.ts.dist
  • Write provided data to config.ts object and make it available as config object.

Example usage

config.ts.dist

// Add config fields here if you need them in your config.ts file
// Comments may be given at new lines and begin with "//" or "/*"

something.awesome:FSB!!

Run npm run ifc

config.ts

const json = {
  "something": {
    "awesome": "FSB!!"
  }
};

export const config = JSON.parse(JSON.stringify(json));

app.ts

let config = require("./config.ts").config;

console.log(config.something.awesome);

// Output: FSB!!

ToDo

  • Unit testing
  • Improving usability