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

grunt-tagrelease

v0.3.3

Published

This plugin is being deprecated in favor of grunt-release, and will be eventually unpublished. Please migrate.

Downloads

72

Readme

grunt-tagrelease

This plugin is being deprecated in favor of grunt-release, and will be eventually unpublished. Please migrate.

Commit the changes and tag the last commit with a version from provided JSON file. If there is nothing to commit, the task will tag the current last commit.

This task has been created to work with other tasks like grunt-bumpup to help create a nicely configurable release task. You can see an example in Usage Examples section.

This is a Grunt 0.4 plugin. If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins.

Installation

Use npm to install and save the plugin into devDependencies.

npm install grunt-tagrelease --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-tagrelease');

Configuration

In your project's Gruntfile, add a section named tagrelease to the data object passed into grunt.initConfig(). This is a simple task, and does not conform to multi task options & files input types! All available configuration styles are described below.

This is the most verbose form of the configuration with default options and a version from a JSON file:

grunt.initConfig({
	tagrelease: {
		file: 'package.json',
		commit:  true,
		message: 'Release %version%',
		prefix:  'v',
		annotate: false,
	},
});

Version from a version property, and no prefix:

grunt.initConfig({
	tagrelease: {
		version: '1.0.1',
		prefix:  '',
	},
});

Version retrieved from a function passed to the version property, and enabled annotated tags:

grunt.initConfig({
	tagrelease: {
		version: function () {
			return '1.0.1';
		},
		annotate:  true,
	},
});

Simple configs

Default options and a new version from a JSON file:

grunt.initConfig({
	tagrelease: 'package.json'
});

Default options and a new version expanded from a template:

grunt.initConfig({
	pkg: grunt.file.readJSON('package.json'),
	tagrelease: '<%= pkg.version %>'
});

Default options and a new version passed directly:

grunt.initConfig({
	tagrelease: '1.0.1'
});

Default options and a new version from a function:

grunt.initConfig({
	tagrelease: function () {
		return '1.0.1';
	}
});

Options

version

Type: Mixed Default: null

New version that will be used as a new tag name. Has a priority over the file option below. Can be a string or a function that returns a string. You have to define either this, or a file option below, otherwise the task won't know what should be the new tag.

file

Type: String Default: null

Path to the JSON file with version that should be used as a new tag. You have to define either this, or a version option above, otherwise the task won't know what should be the new tag.

commit

Type: Boolean Default: true

Whether to commit any un-staged changes before tagging. Does the git commit -a command.

message

Type: String Default: Release %version%

Message to be used in commits, and annotated tags. Available is one token:

  • %version% - Will be replaced with a new version, without a prefix.

prefix

Type: String Default: nothing

Tag prefix. Set to v to have tags line v1.1.0.

annotate

Type: Boolean Default: false

Whether the new tag should be annotated. If enabled, the tag will receive a message from message option.

Usage Examples

Release task

In this example, we create a release task that handles everything needed to build a new release of a project:

// Tasks configuration
grunt.initConfig({
	jshint: ...,
	uglify: ...,
	bumpup: 'package.json',
	tagrelease: 'package.json'
});

// Load the plugins
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-bumpup');
grunt.loadNpmTasks('grunt-tagrelease');

// Release alias task
grunt.registerTask('release', function (type) {
	type = type ? type : 'patch';
	grunt.task.run('jshint');         // Lint stuff
	grunt.task.run('uglify');         // Minify stuff
	grunt.task.run('bumpup:' + type); // Bump up the package version
	grunt.task.run('tagrelease');     // Commit & tag the changes from above
});

And now you can call this command to create a new minor release of a project:

grunt release:minor