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

blum

v1.0.0

Published

A cli tool for generating manifest config.json files. Ideal as a prestart script.

Downloads

62

Readme

Blum

Blum is a configuration document generator used to create Hapi manifest json files using Confidence. It creates a manifest.config.json file through an npm prestart script that Rejoice (the Hapi CLI) can consume on the command line with rejoice -c manifest.config.json.

This could be used for quick A/B testing at a high level or for simple things such as environment based server configuration.

While this was developed to be used in conjunction with a Hapi it can be used anywhere to auto generate a configuration.json based on the Confidence style criteria.

Version npm Build Status Coveralls branch Dependencies


Command Line

Blum takes the following flag options:

  • -c - a required file path for criteria.js to be used by confidence.
  • -m - a required file path for manifest.js to be edited by confidence and consumed by Hapi.
  • -f - an optional output file name/path, defaults to ./manifest.config.json

Example

Use it straight from the command line:

$ blum -c criteria.js -m manifest.js -f manifest.config.json

Use it as a script in your package.json before calling Hapi:

"prestart":  "blum -c config/criteria.js -m config/manifest.js -f config.json"
"start": 	 "rejoice -c manifest.config.json"

More examples

There is an example directory which contains a mock package.json file. Running $ npm start from within this folder will generate a manifest config file based on the details being passed from the package.json file. After it's created it will then run a Hapi server via the Rejoice CLI.

You can modify these settings as you like. If you add an environment variable before the call you will see a different manifest config file generated, this is the magic of Confidence.

Criteria & Manifest files

Ensure that your criteria.js and manifest.js files both export a valid object that can be consumed by Confidence. Please check their docs for more details on this.

Example Criteria.js

module.exports = {
	env: process.env.ENVIRONMENT
};

Example Manifest.js

The below example prettifies the jade html by default but when run in a production environment the html is minified.

module.exports = {
	connections: [
    	{
        	port: 3000,
        	labels: [
            	'http'
        	]
    	}
	],
	server: {},
	plugins: {
		visionary: {
        	engines: {
            	jade: 'jade'
        	},
        	path: './views',
        	compileOptions: {
            	$filter: 'env',
            	production: {
                	pretty: false
            	},
            	$default: {
                	pretty: true
            	}
        	}
		}
	}
};