Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

git-tag-version

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-tag-version

Calculate project version from git tags.

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

git-tag-version

Calculate project version from git tags.

This module provides a function that calculates and returns project's current version based on git tags. It is very useful when you need to calculate your project version in CI or deployment plans.

This moudle has been based on and is a more generalised (framework-agnostic) version of grunt-release-plugin by Jerzy Jelinek.

Getting Started

npm install git-tag-version --save-dev

Once the module has been installed, just load it in your node project:

var gitVersion = require('git-tag-version');

Usage

gitVersion(options);

Parameter options is optional. It may contain these options:

  • uniqueSnapshot (default = false)
    if false, snapshot versions will be suffixed with just -SNAPSHOT, e.g. 1.0.0-SNAPSHOT; otherwise, current abbreviated git commit's hash will be appended as well, e.g. 1.0.0-SNAPSHOT.c1b653ff

Examples

git init
touch file.js
git add file.js
git commit -m "add file.js"
git tag -a v0.1.0 -m "v0.1.0"
console.log(gitVersion()); // will print "0.1.0"
touch file2.js
git add file2.js
git commit -m "add file2.js"
console.log(gitVersion()); // will print "0.1.1-SNAPSHOT"
console.log(gitVersion({uniqueSnapshot: true})); // will print something like "0.1.1-SNAPSHOT.c1b653ff"
git tag -a v0.1.1 -m "v0.1.1"
console.log(gitVersion()); // will print "0.1.1"

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Keywords

FAQs

Package last updated on 28 Mar 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc