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 🙏

© 2024 – Pkg Stats / Ryan Hefner

tagy

v1.10.7

Published

Create a new git tag by following the 'Semantic Versioning' and push it on remote.

Downloads

19

Readme

tagy

An easy way to create Git releases using git tags. Create a new git tag by following the 'Semantic Versioning' and push it on remote.

Note: This will also bump the version in package.json before pushing it on remote origin.

NPM

Install globally:

npm i tagy -g

Use it in terminal from working directory:

tagy [-p, -m, --minor, --patch, --major, --reverse, --info, --custom, -h]
Arguments
-p, --patch    # Will increase the version from 1.0.0 to 1.0.1
-m, --minor    # Will increase the version from 1.0.0 to 1.1.0
--major        # Will increase the version from 1.0.0 to 2.0.0
--reverse      # Will remove the last tag and revert to previously created one.
--info         # Get some info about current project.
--custom       # Define the new Semantic version manually.
--soft         # Create a soft tag. This will not commit the changes to git or create a new git tag.
--auto-release # Automatically create a Github release after the tag is created.
-h             # Show help information.

package.json configuration:

All parameters are optional.

"tagy": {
    "tagPrefix": "v",
    "soft": true,
    "auto-release": true,
    "replace": [
        {
            "files": "themes/custom/style.css",
            "from": "Version: \\d+\\.\\d+\\.\\d+",
            "to": "Version: __VERSION__",
            "flags": "g"
        }
    ]
}

Description of the above parameters:

  • tagPrefix - (optional) Allows to create releases with a prefix. For example, if you want to create a release with a prefix v and the version is 1.0.0, the tag will be v1.0.0. The tag in git will be v1.0.0.
  • soft - (optional) Allows to create a new version which will update only the package.json and follow any rules in tagy.js file or package.json, but will not commit the changes to git or create a new git tag. So basically, it will do only a search and replace in files without affecting the git tags.
  • auto-release - (optional) Allows to create a Github release directly from terminal after the tag is created (automatically, without confirmation).
  • replace - (optional) Allows to define custom replacement rules in package.json file. For example, if you want to replace the version in a file named style.css with the version from package.json, add the following in package.json:
    • files - (required) The file or files where the replacement will be done. This can be a string or an array of strings. Relative to package.json file!
    • from - (required) The string or regex to search for. If you define a regex, make sure to escape the special characters and double escape the backslash.
    • to - (required) The string to replace the matched string or regex of from. You can use the __VERSION__ placeholder to use the new version from package.json.
    • flags - (optional) The flags to use for the regex. Default is g.

The above from and to parameters accept 2 types of variables:

  • __VERSION__ - This will be replaced with the new version from package.json.
  • __CURRENT_TAG__ - This will be replaced with the current tag from git.

Extend it:

Custom scripts before git push is executed.

Create a file in your project directory named tagy.js and inside export a module function with some logic. This function will be executed just before the git push command is called. Doing so you have the option to manipulate the files before they are released. For example:

module.exports = (newVersion, oldVersion, args) => {
    console.log('Custom "tagy" scripts can be used before git push');
}

A real example, replacing the version in a css file.

const path = require('path');
const replace = require('replace-in-file');

module.exports = (newVersion, oldVersion, args) => {
    replace.sync({
        files: path.resolve(__dirname, 'src/style.css'),
        from: /Version: \d+\.\d+\.\d+/g,
        to: `Version: ${newVersion}`,
    });
}

New in version 1.8

Soft tag:

A soft tag will allow to create a new version which will update only the package.json and follow any rules in tagy.js file, but will not commit the changes to git or create a new git tag.

So basically, it will do only a search and replace in files without affecting the git tags.

To enable this, add the following in package.json:

"tagy": {
    "method": "soft"
}

New in version 1.9

Tag Prefix:

This allows to create releases with a prefix.

For example, if you want to create a release with a prefix v and the version is 1.0.0, the tag will be v1.0.0.

To enable this, add the following in package.json:

"tagy": {
    "tagPrefix": "v"
}

New in version 1.10

Replacements from package.json:

This allows to define custom replacement rules in package.json file.

For example, if you want to replace the version in a file named style.css with the version from package.json, add the following in package.json:

"tagy": {
    "replace": [
        {
            "files": "themes/custom/style.css",
            "from": "Version: \\d+\\.\\d+\\.\\d+",
            "to": "Version: __VERSION__",
            "flags": "g"
        }
    ]
}

In the above example we replace the version from style.css with the new version from package.json file.

This is an array of objects, so you can define multiple replacements.

Other changes in version 1.10 include:

  • Added --soft argument to create a soft tag directly from terminal.
  • Deprecated {"method": "soft"} in package.json file. Use {"soft": true} instead.

New in version 1.10.1

  • Added Github release prompt. This will allow to create a Github release directly from terminal after the tag is created.

New in version 1.10.3

  • Added --auto-release argument to create a Github release directly from terminal after the tag is created (automatically, without confirmation).
  • Added auto-release option in package.json file. This will allow to create a Github release directly from terminal after the tag is created (automatically, without confirmation).