program-version
v1.0.0
Published
Returns the program/package name and version as a string with optional format customization.
Downloads
1,061
Maintainers
Readme
program-version
Returns the program/package name and version as a string with optional format customization.
$ npm install program-version --save
Usage
import and configure.
// specify directory of `package.json`
var version = require('program-version')(__dirname)
// directory of `package.json` is inferred
var version = require('program-version')()
program/package name, leading v
and version.
version()
//=> program vN.N.N
Format Options
%(program)s
: program/package name%(vprefix)s
: v%(version)s
: version (i.e. 0.1.0)
program/pacakge name only.
version('%(program)s');
//=> program
program/package name and version (no leading v
).
version('%(program)s %(version)s');
//=> program N.N.N
version only.
version('%(version)s');
//=> N.N.N