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-git-them-all

v0.0.13

Published

All Git commands for grunt

Downloads

6

Readme

Announcement

This plugin is not being developed anymore. I recommend to use grunt-simple-git


grunt-git? no, its better! its "grunt, git them all"!

All Git commands for grunt

Why I came with one more grunt plugin for git?

We already have nice and fancy, well tested and fully configuralble plugin for that. So what is wrong with it?

  • It used not to support run of git commands in custom path. I cooked a PR, but ... it was bad. Other guy did a better one, but it still requires one more option to have all that work.
  • I needed to run a command with option that was not supported by that plugin. I came with PR, but ... it did not have tests (yea, I am a bit lazy).
  • I needed to run a command that was supported by that plugin. But its explicit run is impossible because it is included into other task/command.

Ok, lets try to find some pros for that plugin. It supports dozen of tasks/commands which have tons of options. All that crowd turns into words and then into final string with word 'git' at start. And only after that its being invoked. Still as a shell command.

What the reason to go around if you just need 1 simple thing? I think most of that buzz is useless there. Key of my plugin is next: just write command and get what you need

Getting Started

This plugin requires Grunt ~0.4.0

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-git-them-all --save-dev

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

grunt.loadNpmTasks('grunt-git-them-all');

The "gta" task

Overview

In your project's Gruntfile, add a section named gta (aka Git Them All) to the data object passed into grunt.initConfig().

grunt.initConfig({
  gta: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific command and/or options go here.
    },
  },
});

Command

Type: String Default value: undefined

Git command you want to run. Its not mandatory to specify leading git. Required

Options

options.cwd

Type: String Default value: null

A path where git command will be run

options.failOnError

Type: boolean Default: true

Fail task if it encounters an error

options.stdout

Type: boolean Default: false

Show stdout in the terminal.

options.stderr

Type: boolean Default: false

Show stderr in the terminal.

options.storeOutputTo

Type: string Default: null

Store output of the command to grunt's config by specified key

options.postProcessOutput

Type: function Default: function(text) { return text; }

Does postprocessing of output before it will be stored. Requires storeOutputTo to be set

Usage Examples

grunt.initConfig({
    gta: {
        add_target: {
            command: 'add -A .',
            options: {
                stdout: true
            }
        },
    },
});

grunt.initConfig({
    gta: {
        options: {
            cwd: '/path/where/to/run/git/command'
        },
        target_a: {
            command: 'tag "v0.5.0"',
            options: {
                stderr: true
            }
        },
        target_b: {
            command: 'push origin master'
            options: {
                stderr: true
            }
        },
    },
});

grunt.initConfig({
    gta: {
        branch: {
            command: 'rev-parse --abbrev-ref HEAD'
            options: {
                storeOutputTo: 'currentBranch'
                postProcessOutput: function(output) {
                    return output.trim();
                }
            }
        },
    },
});
...
grunt.registerTask('git-branch', 'print current branch', function() {
    grunt.log.writeln('current branch is: ' + grunt.config('currentBranch'));
});