# grunt-git-authors

> Generate a list of authors from the git history.

Latest version **3.2.0** (published 2016-04-18) · 0 weekly downloads

## Install

```sh
npm install grunt-git-authors
pnpm add grunt-git-authors
yarn add grunt-git-authors
bun add grunt-git-authors
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2016-04-18 |
| First published | 2012-07-05 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Scott González |
| Maintainers | scott.gonzalez |
| Keywords | gruntplugin |

## Links

- npm: https://www.npmjs.com/package/grunt-git-authors
- Repository: https://github.com/scottgonzalez/grunt-git-authors
- Issues: https://github.com/scottgonzalez/grunt-git-authors/issues
- npm.io page: https://npm.io/package/grunt-git-authors

## Dependencies (1)

- [spawnback](https://npm.io/package/spawnback.md) ~1.0.0

## Recent versions

- 3.2.0 (latest) — 2016-04-18
- 3.1.1 — 2016-02-11
- 3.1.0 — 2015-12-04
- 3.0.0 — 2015-03-03
- 2.0.1 — 2014-12-02
- 2.0.0 — 2014-10-23
- 1.2.0 — 2013-03-12
- 1.1.0 — 2013-02-25
- 1.1.0-beta.1 — 2012-12-17
- 1.0.0 — 2012-07-05

## README

# grunt-git-authors

A [grunt](https://github.com/gruntjs/grunt) plugin for generating a list of
authors from the git history.

Support this project by [donating on Gratipay](https://gratipay.com/scottgonzalez/).

This project supports both a [Node API](#node-api) and a [Grunt API](#grunt-api).

## Grunt compatibility

v1.1.0+ is compatible with Grunt 0.4. If you're using Grunt 0.3, use v1.0.0.

## Grunt API

### Tasks

#### authors

Generates a list of authors in the form `Name <email>` in order of first
contribution.

This task writes its output to the console, not to a file.

You can optionally run this task against a subdirectory:

```sh
grunt authors:path/to/directory
```

#### update-authors

Creates or updates the file `AUTHORS.txt` with the list of authors.

You can optionally run this task against a subdirectory (the `AUTHORS.txt`
file will be placed inside that directory):

```sh
grunt update-authors:path/to/directory
```

#### update-contributors

Updates `package.json` with the list of authors.

You can optionally run this task against a subdirectory (the `package.json`
file inside that directory will be used):

```sh
grunt update-contributors:path/to/directory
```

### Config

#### authors.order

Define the order of the list of authors. The default ordering is by first
contribution `{order: "date"}`. An alternative ordering is by number of
contributions `{order: "count"}`.

*NOTE: This config value is used for the `update-authors` task as well.*

```js
grunt.initConfig({
	authors: {
		order: "count"
	}
});
```

#### authors.prior

Define a list of authors that contributed prior to the first commit in the repo.
This is useful if you've moved from another version control system.

*NOTE: This config value is used for the `update-authors` task as well.*

```js
grunt.initConfig({
	authors: {
		prior: [
			"Jane Smith <jane.smith@example.com>",
			"John Doe <john.doe@example.com>"
		]
	}
});
```

## Node API

This module can also be used directly via `require( "grunt-git-authors" )`.

### getAuthors( options, callback )

Gets the list of authors.

* `options` (Object)
  * `dir` (String): Which directory to inspect for authors (defaults to `"."`).
  * `priorAuthors` (Array): An array of authors that contributed prior to the first commit in the repo.
  * `order` (String): Which criteria to use for ordering the authors. `"date"` will order by first contribution; `"count"` will order by number of contributions. Defaults to `"date"`.
* `callback` (`function( error, authors )`): A callback to invoke with the list of authors.
  * `authors`: An array of authors in the form of `Name <email>`.

### updateAuthors( options, callback )

Creates or updates an authors file with all authors.

* `options` (Object)
  * `dir` (String): Which directory to inspect for authors (defaults to `"."`).
  * `priorAuthors` (Array): An array of authors that contributed prior to the first commit in the repo.
  * `order` (String): Which criteria to use for ordering the authors. `"date"` will order by first contribution; `"count"` will order by number of contributions. Defaults to `"date"`.
  * `filename` (String): Which file to create (defaults to `"AUTHORS.txt"`).
  * `banner` (String): Text to place at the top of the file (defaults to `"Authors ordered by first contribution"`).
* `callback (`function( error, filename )`): A callback to invoke after writing the file.
  * `filename`: The path of the file that was written.

### updatePackageJson( options, callback )

Updates `package.json` with all authors.

* `options` (Object)
  * `dir` (String): Which directory to inspect for authors (defaults to `"."`).
  * `priorAuthors` (Array): An array of authors that contributed prior to the first commit in the repo.
  * `order` (String): Which criteria to use for ordering the authors. `"date"` will order by first contribution; `"count"` will order by number of contributions. Defaults to `"date"`.
* `callback (`function( error )`): A callback to invoke after writing the file.

## Mailmap

This task respects mailmap, so if you have messy author info in your commits,
you can correct the data in your mailmap and this task with output the cleaned
up information. For more information, about using a mailmap, see the docs for
`git-shortlog` or read Shane da Silva's blog post about
[Git Shortlog and Mailmap](http://shane.io/2011/10/07/git-shortlog-and-mailmap.html).

## License

Copyright Scott González. Released under the terms of the MIT license.

---

Support this project by [donating on Gratipay](https://gratipay.com/scottgonzalez/).

---
_Source: https://npm.io/package/grunt-git-authors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
