New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

grunt-release-plugin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-release-plugin

Calculate project version from git tags and mark SNAPSHOT versions.

latest
Source
npmnpm
Version
1.1.4
Version published
Maintainers
1
Created
Source

grunt-release-plugin

Calculate project version from git tags and mark SNAPSHOT versions.

This plugin has two tasks:

  • currentVersion which calculates and prints projects current version object on the screen,
  • metadata which prints all metatadata with calculated projects current version.
  • compress which is a grunt-contrib-compress task. The path for created package is always the same - target/universal/projectName-calculatedCurrentVersion.zip

It is very useful when you need to calculate your project version in CI.

Getting Started

This plugin requires Grunt ~0.4.5

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. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-release-plugin --save-dev

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

grunt.loadNpmTasks('grunt-release-plugin');

The "release_plugin" task

Overview

In your project's Gruntfile, add a section named release_plugin to the data object passed into grunt.initConfig().

grunt.initConfig({
  release_plugin: {
    options: {
      // Task-specific options go here.
    },
    currentVersion: {},
    metadata: {},
    compress: {...}
  }
});

Options

options.repo

Type: String Default value: .

A string value describes path to repository, usually current folder ..

options.pkg

Type: Object Default value: {}

An object with version (which will be replaced) any any other stuff returned by metadata task, usually package.json

Usage Examples

Default Options

grunt.initConfig({
  release_plugin: {
    options: {
      repo: ".",
      pkg: grunt.file.readJSON('package.json')
    },
    currentVersion: {},
    metadata: {},
    compress: {
      main: {
        files: [
          {
            src: ['./dist/*'],
            dest: '<%= pkg.name %>/',
            filter: 'isFile'
          }
        ]
      }
    }
  }
});

Shell example

git init
touch file.js
git add file.js
git commit -m "add file.js"
git tag -a v0.1.0 -m "v0.1.0"
grunt release_plugin:currentVersion #will return {"currentVersion":"0.1.0"}

touch file2.js
git add file2.js
git commit -m "add file2.js"
grunt release_plugin:currentVersion #will return {"currentVersion":"0.1.1-SNAPSHOT"}

git tag -a v0.1.1 -m "v0.1.1"
grunt release_plugin:currentVersion #will return {"currentVersion":"0.1.1"}

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Keywords

gruntplugin

FAQs

Package last updated on 13 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts