Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mochajs/contributors
Add & update list of Git contributors in package.json
https://github.com/mochajs/contributors
author collaborators committers contributors git npm package-json
Last synced: 3 months ago
JSON representation
Add & update list of Git contributors in package.json
- Host: GitHub
- URL: https://github.com/mochajs/contributors
- Owner: mochajs
- License: other
- Archived: true
- Created: 2018-12-08T01:33:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-18T23:34:26.000Z (about 4 years ago)
- Last Synced: 2024-09-18T23:34:55.677Z (4 months ago)
- Topics: author, collaborators, committers, contributors, git, npm, package-json
- Language: JavaScript
- Homepage:
- Size: 696 KB
- Stars: 5
- Watchers: 9
- Forks: 4
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @mocha/contributors
> Add & update list of Git contributors in `package.json`
**MOCHA NO LONGER USES THIS PACKAGE AND IT WILL SEE NO FURTHER DEVELOPMENT**
This module uses `git` to find all committers to a repo; it respects [`.mailmap`](https://www.git-scm.com/docs/git-check-mailmap#_mapping_authors), if present.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [License](#license)## Install
```shell
$ npm i @mocha/contributors -D
```## Usage
```plain
contributors [options]Options:
--help Show help [boolean]
--version Show version number [boolean]
--exclude, -x Exclude author/email from list (repeatable)
[array] [default: (author prop of package.json)]
--package, -p, --pkg Path of package.json to update
[string] [default: (closest package.json)]
--property Name of property to update
[string] [default: "contributors"]
```Configuration can be specified using the `@mocha/contributors` property of your `package.json`, e.g.:
```json
{
"@mocha/contributors": {
"exclude": ["some", "people"],
"package": "/path/to/package.json",
"property": "contributors"
}
}
```## API
### @mocha/contributors
Provides functions to get contributors from commit history, process and write those contributors to `package.json`.* [@mocha/contributors](#module_@mocha/contributors)
* [.getContributors([opts])](#module_@mocha/contributors.getContributors) ⇒Array.<string>
* [.updateContributors([opts])](#module_@mocha/contributors.updateContributors) ⇒string
#### @mocha/contributors.getContributors([opts]) ⇒
Array.<string>
Get list of contributors to Git repo at path `cwd`, excluding names/emails defined in `exclude`. `locale` and `localeOpts` must be consistent between calls in order to avoid too much churn in the contributors list.**Kind**: static method of [
@mocha/contributors
](#module_@mocha/contributors)
**Returns**:Array.<string>
- Sorted list of contributors
**Access**: public
**See**- https://git-scm.com/docs/git-log
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [opts] |Object
|{}
| Options |
| [opts.exclude] |Array.<string>
\|Set.<string>
|[]
| A list of authors/emails to ignore; must be exact match |
| [opts.cwd] |string
| | Working copy dir; defaults to `process.cwd()` |
| [opts.locale] |string
\|Array.<string>
|"en-US"
| Locale(s) to pass to `String.prototype.localeCompare` |
| [opts.localeOpts] |Object
|{sensitivity: 'accent'}
| Options for `String.prototype.localeCompare` |**Example**
```js
// get list of contributors for your package (without Guy Fieri)
const {getContributors} = require('@mocha/contributors');
getContributors(
['Guy Fieri '],
'/path/to/working/copy/',
'en-US',
{sensitivity: 'accent'}
); // returns Array of contributors
```#### @mocha/contributors.updateContributors([opts]) ⇒
string
Given a path to a package.json `pkg`, update Git contributors in the property defined by `property`, excluding those in the `exclude` array.**Kind**: static method of [
@mocha/contributors
](#module_@mocha/contributors)
**Returns**:string
- Resulting `package.json`
**Access**: public| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [opts] |Object
| | Options |
| [opts.pkg] |string
| | Path to `package.json`; searches for closest by default |
| [opts.exclude] |Array.<string>
\|Set.<string>
| | A list of authors/emails to ignore; defaults to `author` prop of found `package.json` |
| [opts.property] |string
|"contributors"
| Property name to update |## Maintainers
[@boneskull](https://github.com/boneskull)
## Contribute
PRs accepted.
Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
## License
Apache-2.0 © 2019 JS Foundation & Contributors