Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
get-project-version
Advanced tools
This module will return the current project version string. The version string is made of the last git tag or package.json version (if no git tag exists) and the last commit hash.
This module will return the current project version string. The version string is made of the last git tag or package.json version (if no git tag exists) and the last commit hash.
$ npm install get-project-version
The following is a basic example:
import getProjectVersion from 'get-project-version';
const version = getProjectVersion();
console.log(version); // Version: 1.0.0 Commit: 081b152
This example shows how you can customize the output of get-project-version
using a template string:
import getProjectVersion from 'get-project-version';
const version = getProjectVersion({
template: '{{version}}-{{commit}}'
});
console.log(version); // 1.0.0-081b152
There are cases where you'd like to output a version string for a particular folder this can be done like this:
import getProjectVersion from 'get-project-version';
const version = getProjectVersion({
cwd: 'pathToProjectDir/'
});
console.log(version); // 1.0.0-081b152
const version = getProjectVersion([options]);
Options you can pass getProjectVersion
:
template
- An optional String which templates the output of getProjectVersion
. Version will be injected into {{version}}
and a shortened commit hash will be injected into {{commit}}
. eg. '{{version}}-{{commit}}'
cwd
- An optional String. By default the current working directory will be process.cwd()
you can modify this by passing a path. eg. 'pathToProjectDir/'
$ get-project-version
The above would output to stdout something like Version: 1.0.0 Commit: 081b152
$ get-project-version --template '{{version}}-{{commit}}'
The above would output to stdout something like 1.0.0-081b152
$ get-project-version --cwd pathToProjectDir/
The above would output a version string for pathToProjectDir/
MIT, see LICENSE.md for details.
FAQs
This module will return the current project version string. The version string is made of the last git tag or package.json version (if no git tag exists) and the last commit hash.
The npm package get-project-version receives a total of 10 weekly downloads. As such, get-project-version popularity was classified as not popular.
We found that get-project-version demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.