Giter Site home page Giter Site logo

git-latest-tag's Introduction

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

git-latest-tag's People

Contributors

stevemao avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.