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-gitshow

v0.0.4

Published

Add git show output to files

Downloads

3

Readme

grunt-gitshow

Replaces git show --pretty info in defined placeholders

Install

From NPM:

npm install grunt-gitshow --save-dev

GitShow Task

Once installed, you can configure the gitshow task as follows:

module.exports = function(grunt){
  grunt.loadNpmTasks('grunt-gitshow');
  grunt.initConfig({
    gitshow: {
      backend: {
        options: {
          repo: '../some/path/to/.git',  // your git repo (./ by default)
          format: "%h %an %aD", // --pretty format opts see below
          match: 'my_version' //replace @@my_version by the output of git show --pretty="%h %an %aD"
        },
        files: [
          { 
            expand: true, 
            flatten: true, 
            src: ['<%= yeoman.app %>/index.html'], 
            dest: '<%= yeoman.dist %>'
          }
        ]
      }
    }
  });
  grunt.registerTask('default', 'gitshow');
};

Options

Repo

Type: String

Path of the actual git repository

Format

Type: String

Arguments to git show --pretty see git show documentation. Most commonly used options are:

  • %H: commit hash
  • %h: abbreviated commit hash
  • %T: tree hash
  • %t: abbreviated tree hash
  • %P: parent hashes
  • %p: abbreviated parent hashes
  • %an: author name
  • %aN: author name (respecting .mailmap, see git-shortlog[1] or git-blame[1])
  • %ae: author email
  • %aE: author email (respecting .mailmap, see git-shortlog[1] or git-blame[1])
  • %ad: author date
  • %aD: author date, RFC2822 style
  • %ar: author date, relative
  • %at: author date, UNIX timestamp
  • %ai: author date, ISO 8601-like format
  • %aI: author date, strict ISO 8601 format
  • %cn: committer name
  • %cN: committer name (respecting .mailmap, see git-shortlog[1] or git-blame[1])
  • %ce: committer email
  • %cE: committer email (respecting .mailmap, see git-shortlog[1] or git-blame[1])
  • %cd: committer date
  • %cD: committer date, RFC2822 style
  • %cr: committer date, relative
  • %ct: committer date, UNIX timestamp
  • %ci: committer date, ISO 8601-like format
  • %cI: committer date, strict ISO 8601 format
  • %d: ref names, like the --decorate option of git-log[1]
  • %D: ref names without the " (", ")" wrapping.
  • %e: encoding
  • %s: subject
  • %f: sanitized subject line, suitable for a filename
  • %b: body
  • %B: raw body (unwrapped subject and body)
  • %N: commit notes

An ugly %v has been added to get the output of git describe --tags instead of the git show executed otherwise.

Match

Type: String|RegExp Indicates the matching expression.

If matching type is String we use a simple variable lookup mechanism @@string (in any other case we use the default regexp replace logic). See Applause doc for details, as replacement is done via Applause lib.

    // using strings
    options: {
      repo: '../some/path/to/.git',  // your git repo (./ by default)
      format: "%h %an %aD", // --pretty format opts see below
      match: 'my_version' //replace @@my_version by the output of git show --pretty="%h %an %aD"
    }

    // using regexp
    options: {
      repo: '../some/path/to/.git',  // your git repo (./ by default)
      format: "%h %an %aD", // --pretty format opts see below
      match: /foo/g //replace all `foo` by the output of git show --pretty="%h %an %aD"
    }

Release History

  • 2015-03-13 v0.0.4 Adds %v format flag to print git describe --tags
  • 2015-03-12 v0.0.3 Improves task output
  • 2015-03-12 v0.0.2 --quiet option added to silence diff.
  • 2015-03-12 v0.0.1 First Released.