1.1.1 • Published 6 years ago
@vendoor/what-version v1.1.1
what-version
Emits the version of an application or project.
npx -q @vendoor/what-version -f git.hash git.branch npm.versionExample output for the above command on the stdout:
{
"git.hash": "7c857e22c47d2a85c7407632d0b33a498778639c",
"git.branch": "master",
"npm.version": "1.0.0"
}CLI Usage
what-version has a single command line option which can be used to specify the desired fields. You may specify -f once:
npx -q @vendoor/what-version -f npm.version git.branchOr you can specify -f multiple times:
npx -q @vendoor/what-version -f npm.version -f git.branchLibrary Usage
Alternatively, you can use what-version as a library. It exposes a single function, query:
async query(fields, cwd)fields- The name of the queried fields (required).cwd- The working directory of the project (required).
const whatVersion = require('@vendoor/what-version');
(async main() {
const data = await whatVersion.query(['npm.version, git.hash'], '.');
})();Available Fields
The following fields are available:
git.branch- The current git branch.git.hash- The hash of the latest git commit.npm.version- The value of the version field in thepackage.json.
1.1.1
6 years ago