platform-config

0.1.5 • Public • Published

platform-config

Description

Fetch and validate platform configurations more easily

Installation

$ npm install --save platform-config

If you'd like to try these examples, please run gulp prepare-examples first

// ./examples/easy/index.js
 
'use strict';
 
var path = require('path');
var platformConfig = require('platform-config');
 
var platforms = platformConfig({
  targets: path.join(__dirname, 'targets')
});
 
var current = platforms.current();
console.log(current);
 

In targets are the following files:

// ./examples/easy/targets/development.js
 
'use strict';
 
var config = {
  description: 'BY THE POWER OF DEVELOPMENT'
};
 
module.exports = config;
 
// ./examples/easy/targets/production.js
 
'use strict';
 
var config = {
  description: 'BY THE POWER OF PRODUCTION'
};
 
module.exports = config;
 
$ node examples/easy
{ description: 'BY THE POWER OF DEVELOPMENT' }
$ node examples/easy --NODE_ENV production
{ description: 'BY THE POWER OF PRODUCTION' }
export NODE_ENV=production
$ node examples/easy
{ description: 'BY THE POWER OF PRODUCTION' }

You can test and unset NODE_ENV like so:

echo $NODE_ENV
production
unset NODE_ENV
echo NODE_ENV
 

Running tests

$ gulp test

Test reports are written to ./reports.

Contributing

  • Do pull requests.
  • Make sure there's tests and meaningful coverage.
  • Respect ./eslintrc.
  • Issues should go in issues.

Readme

Keywords

none

Package Sidebar

Install

npm i platform-config

Weekly Downloads

22

Version

0.1.5

License

MIT

Last publish

Collaborators

  • jpwesselink