Skip to content
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.

FCO/git-latest-tag

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM version Build Status Dependency Status Coverage Status

Get the most recent git tag of your repository using git-describe(1)

Install

$ npm install --save git-latest-tag

Usage

Use a callback

var getLatestTag = require('git-latest-tag');
var options = {
  all: 'ok',
  contains: true,
  candidates: 10,
  'commit-ish': 'HEAD'
};

getLatestTag(options, function(err, tag) {
  console.log(tag);
  //=> latestTag
});

Use as a readable stream

var getLatestTag = require('git-latest-tag');
var options = {
  all: 'ok',
  contains: true,
  candidates: 10,
  'commit-ish': 'HEAD'
};

getLatestTag(options)
  .pipe(...);

Use it synchronously

var getLatestTagSync = require('git-latest-tag').sync;
var options = {
  all: 'ok',
  contains: true,
  candidates: 10,
  'commit-ish': 'HEAD'
};

var tag = getLatestTagSync(options);
console.log(tag);
//=> latestTag

API

getLatestTag([options], [callback])

Returns a readable stream.

options

Type: object or boolean

All options will be dash-cased for you.

Please check the available options at http://git-scm.com/docs/git-describe.

You can also define a specific Git repo other than the current path through the 'repoPath' option:

// Options to get latest tag from current branch of a given repo
var options = {
  tags: true,
  abbrev: 0,
  repoPath: '/path/to/repo'
};

NOTE: if a flag takes no value and the passed options.value is truthy, it will generate the flag only without any value. If it's falsy the flag will not be included.

If it's a true, it will suppress long format, only showing the closest tag in refs/tags namespace and will return an empty string if there is no tags but more than one commit (same as { tags: true, abbrev: 0 }).

callback(err, tag)

License

MIT © Steve Mao

About

Get the most recent git tag of your repository using git-describe(1)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%