npcp
An npm package config parser.
If you use Node.js you already know that npm
is awesome, but I am really sure that you mostly use it only npm install
your dependencies. Turns out that npm
has way more power than that, like creating new modules, bundling them, publishing them and it even allows you to start up your apps, set configuration options on your package.json
and even overwrite your default settins using npm config
.
Getting Started
Install the module with: npm install npcp
// without npcphttp; // with npcpvar config = ;http;
Documentation
The usage of npcp
is really straight forward. First, you'll need to add a config
field on your package.json
, then, you'll need to create a start
(or similar) setting on the same package.json
in order to let npm inject the npm_package_config_*
variables on process.env
, and finally just assign the module to your favorite variable name and use it.
Examples
package.json
"name": "test" "description": "a cool test of npcp" "version": "0.1.0" "scripts": "tryme": "node tryme.js" "dependencies": "npcp": "0.1.0" "config": "port": 3000 "connections": "host": "localhost:3001" "host": "localhost:3002"
tryme.js
console;console;console;console; console; var config = ;console;console;configconnections;
And, when running the above examples using npm...
$ npm run-script tryme > npcp@0.1.0 tryme> node tryme.js Without npcp... :-
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
Release History
- 0.1.0-2 Updating package keywords and README.md release history.
- 0.1.0-1 Added tryme.js example.
- 0.1.0 Initial release.
License
Copyright (c) 2013 Erick Ruiz de Chavez Licensed under the MIT license.