simple-variants
Simple application variants for node.js
Installation
$ yarn add simple-variants
Usage
In the root of your project create a .variants
or .variants.yml
file. The
file can be json or yaml. It should contain a default
object, your variants
will overwrite specified properties of the default
.
const variants = processenvvariant console // "Hello, World!" or "Yo, World!"console // "1.0.0"console // "blue"
or
const variants = processenvvariant consoleconsoleconsole // exported variants are frozen and can not be modifiedvariantscolor = 'red' //throws an error
The constructor accepts a second argument if you wish to use a custom path for your variants file:
const variants = processenvvariant'/path/to/file.yml'
CLI
If you don't want to ship all your variant information, use the included executable to pre-render the variant you'll be targeting.
Usage: simple-variants [options] Options: -h, --help output usage information -V, --version output the version number -v, --variant [name] the name of the variant to write [default] -i, --input [path] the path to your input file [./variants] -o, --output [path] the path to your output file [./.variants] -f, --format [json|yaml] the format of the output [json]
Contributing
See the CONTRIBUTING
file.
License
See LICENSE
file