npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

git-prefix-tag

v0.1.1

Published

get git tags with prefix

Readme

git-prefix-tag

get git tags with prefix

Install

$ npm install git-prefix-tag --save-dev

Usage

Assume you have tags like below

4de0361ae9c51f51fb6d3a50addfff6ca2d64a99 refs/tags/dev-v0.0.1 9ec697394a8def124f5b7c85e27a991adbff2c86 refs/tags/dev-v0.1.1 3dbfd9dbce2f48c68051d025e037b54bc17b015a refs/tags/dev-v0.1.2 5409b3f8b96087d73973efdacc0a290b873612e3 refs/tags/dev-v0.1.3 364a61ea754e8150e3bf460bc37709732260a851 refs/tags/prod-v0.1.0 a0ebc1571e2c69725877191d688c815701a49e78 refs/tags/prod-v0.1.1 a0ebc1571e2c69725877191d688c815701a49e78 refs/tags/sth-werid d5b47d82ecd19b5c19fe2bd28294ad887968a5aa refs/tags/prod-v0.1.2 10817d87a8182d2a72b174ffb70b879555a2b73c refs/tags/prod-v0.1.3-alpha 45a75e99ea1a6c333eadf81bdbfac164f6613955 refs/tags/prod-v0.1.4-beta 702139d72160a729854e3adbc62a2955f87e212b refs/tags/prod-v0.1.5 984e86d46ef724d4d06026740624cce5ecdb59fd refs/tags/prod-v0.1.6-beta

You can use git-prefix-tag to fetch the tag you want.

getLatest

This function definition is below.

function getLatest(prefix: string | regExp | Function, options: {
    semver: boolean = false,
    wholeVersion: boolean = false,
    withPrefix: boolean = false,
    all: boolean = false,
}): string | semver {}

You can use getLatest to get the latest version.

const helper = require('git-prefix-tag');
console.log(helper.getLatest('dev-v')); // 0.1.3

Options

There are several options here.

withPrefix

You can add withPrefix option to get the whole tag

const helper = require('git-prefix-tag');
console.log(helper.getLatest('dev-v', { withPrefix: true })); // dev-v0.1.3

semver

You can get a semver object.

const helper = require('git-prefix-tag');
console.log(helper.getLatest('dev-v', { semver: true }));
/*
{
  "semver": {
    "raw": "0.1.3",
    "major": 0,
    "minor": 1,
    "patch": 3,
    "prerelease": [],
    "build": [],
    "version": "0.1.3"
  },
  "wholeVersion": "0.1.3",
  "prefix": "dev-v",
  "tag": "dev-v0.1.3",
  "version": "0.1.3"
}
*/

Input

you can custom your input

RegExp

const helper = require('git-prefix-tag');
console.log(helper.getLatest(/dev-v/)); // 0.1.3

Function

const helper = require('git-prefix-tag');
console.log(helper.getLatest(() => 'dev-v'))); // 0.1.3

increase

You can get the increace tag based on the latest tag through this function. Its definition is like this.

function increase(prefix: string | regExp | Function, type: 'major' | 'premajor' | 'minor' | 'preminor' | 'patch' | 'prepatch' | 'prerelease' = 'patch'): string {}

You can use like this.

const helper = require('git-prefix-tag');
console.log(helper.increase('dev-v')); // '0.1.4'
console.log(helper.increase('dev-v', 'minor')); // '0.2.0'