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

git-commit-stamper

v1.0.10

Published

Updates a log file with selected last git commit data

Downloads

44

Readme

git-commit-stamper

NPM version CircleCI built with typescript JavaScript Style Guide

Updates a log file with selected last git commit data using handlebars tags.

This is useful for stamping in the commit subject / body / etc into your changelog entry.

Install

npm i git-commit-stamper -g

Usage

The basic command is:

$ git-commit-stamper parse <logFile> [outFile]

The parser gets the last git commit and produces the following object, which is used for template data in handlebars:

{
  "shortHash": "d2346fa",
  "hash": "d2346faac31de5e954ef5f6baf31babcd3e899f2",
  "subject": "initial commit",
  "sanitizedSubject": "initial-commit",
  "body": "this is the body of the commit message",
  "summary": "This is a summary of the change",
  "authoredOn": "1437988060",
  "committedOn": "1437988060",
  "author": {
    "name": "Ozan Seymen",
    "email": "[email protected]"
  },
  "committer": {
    "name": "Ozan Seymen",
    "email": "[email protected]"
  },
  "notes": "commit notes",
  "branch": "master",
  "tags": ['R1', 'R2']
}

newlines

The following properties will have two newlines inserted at the end of their content:

  • subject
  • sanitizedSubject
  • body
  • summary
  • notes

This allows for the following:

{{subject}}{{{body}}}

If the content already has one newline, another will be added. If it has two, no changes will be made.

Example

# CHANGELOG.log

v2 - March 20, 2020

{{subject}}

$ git-commit-stamper parse CHANGELOG.log

Outputs:

v2 - March 20, 2020

initial commit

Including a summary in your changelog

The body content of the git commit might be too large for a changelog.

The template tag summary will be populated if in your commit body, you use the following syntax:

This is my subject line

==summary==
This is a summary of the change
==end summary==

The rest of the commit body

The body tag will have the ==changelog== markers and content removed (but they will remain in the original git commit message).

## {{subject}}{{summary}}
## initial commit

This is a summary of the change

If summary is not empty, then you do not have to worry about adding newlines.

Skip stamping

If you use this tool as part of your CI process, you can skip log stamping by including [skip-changelog] as part of the git commit subject line.

Extended usage

$ git-commit-stamper

git-commit-stamper <command>

Commands:
  git-commit-stamper parse <logFile> [outFile]  Parses a log file with template tags and replaces the
                                                tags with the last git commit info.
  git-commit-stamper tags                       Shows the template data that would be fed into
                                                handlebars.

Options:
  --help     Show help                                                                        [boolean]
  --version  Show version number                                                              [boolean]
$ git-commit-stamper parse --help

git-commit-stamper parse <logFile> [outFile]

Parses a log file with template tags and replaces the tags with the last git commit info.

Positionals:
  logFile  The log file to ingest.                                                  [string] [required]

Options:
  --help      Show help                                                                       [boolean]
  --version   Show version number                                                             [boolean]
  --outFile   Writes output to specified file instead of the original.                         [string]
  --simulate  Prints log output, does not write any data.                    [boolean] [default: false]                                                             [boolean]