Updated docs

This commit is contained in:
Ionică Bizău 2017-09-08 13:56:03 +03:00
parent e67e4ad96d
commit 66d63af1ad
3 changed files with 24 additions and 2 deletions

3
.gitignore vendored
View file

@ -3,3 +3,6 @@
*~ *~
*.log *.log
node_modules node_modules
*.env
.DS_Store
package-lock.json

View file

@ -5,6 +5,7 @@ You can see below the API reference of this module.
### `GitStats(dataPath)` ### `GitStats(dataPath)`
#### Params #### Params
- **String** `dataPath`: Path to the data file. - **String** `dataPath`: Path to the data file.
#### Return #### Return
@ -14,6 +15,7 @@ You can see below the API reference of this module.
Fetches the configuration object from file (`~/.git-stats-config.js`). Fetches the configuration object from file (`~/.git-stats-config.js`).
#### Params #### Params
- **Function** `callback`: The callback function. - **Function** `callback`: The callback function.
#### Return #### Return
@ -23,6 +25,7 @@ Fetches the configuration object from file (`~/.git-stats-config.js`).
Inits the configuration field (`this.config`). Inits the configuration field (`this.config`).
#### Params #### Params
- **Object|String** `input`: The path to a custom git-stats configuration file or the configuration object. - **Object|String** `input`: The path to a custom git-stats configuration file or the configuration object.
- **Function** `callback`: The callback function. - **Function** `callback`: The callback function.
@ -30,6 +33,7 @@ Inits the configuration field (`this.config`).
Records a new commit. Records a new commit.
#### Params #### Params
- **Object** `data`: The commit data containing: - **Object** `data`: The commit data containing:
- `date` (String|Date): The date object or a string in a format that can be parsed. - `date` (String|Date): The date object or a string in a format that can be parsed.
- `url` (String): The repository remote url. - `url` (String): The repository remote url.
@ -46,6 +50,7 @@ removeCommit
Deletes a specifc commit from the history. Deletes a specifc commit from the history.
#### Params #### Params
- **Object** `data`: The commit data containing: - **Object** `data`: The commit data containing:
- `date` (String|Date): The date object or a string in a format that can be parsed. If not provided, the hash object will be searched in all dates. - `date` (String|Date): The date object or a string in a format that can be parsed. If not provided, the hash object will be searched in all dates.
- `hash` (String): The commit hash. - `hash` (String): The commit hash.
@ -60,6 +65,7 @@ Deletes a specifc commit from the history.
Gets the git stats. Gets the git stats.
#### Params #### Params
- **Function** `callback`: The callback function. - **Function** `callback`: The callback function.
#### Return #### Return
@ -69,6 +75,7 @@ Gets the git stats.
Saves the provided stats. Saves the provided stats.
#### Params #### Params
- **Object** `stats`: The stats to be saved. - **Object** `stats`: The stats to be saved.
- **Function** `callback`: The callback function. - **Function** `callback`: The callback function.
@ -79,6 +86,7 @@ Saves the provided stats.
Iterate through the days, calling the callback function on each day. Iterate through the days, calling the callback function on each day.
#### Params #### Params
- **Object** `data`: An object containing the following fields: - **Object** `data`: An object containing the following fields:
- `start` (Moment): A `Moment` date object representing the start date (default: *an year ago*). - `start` (Moment): A `Moment` date object representing the start date (default: *an year ago*).
- `end` (Moment): A `Moment` date object representing the end date (default: *now*). - `end` (Moment): A `Moment` date object representing the end date (default: *now*).
@ -92,6 +100,7 @@ Iterate through the days, calling the callback function on each day.
Creates an object with the stats on the provided period (default: *last year*). Creates an object with the stats on the provided period (default: *last year*).
#### Params #### Params
- **Object** `data`: The object passed to the `iterateDays` method. - **Object** `data`: The object passed to the `iterateDays` method.
- **Function** `callback`: The callback function. - **Function** `callback`: The callback function.
@ -102,6 +111,7 @@ Creates an object with the stats on the provided period (default: *last year*).
Creates the calendar data for the provided period (default: *last year*). Creates the calendar data for the provided period (default: *last year*).
#### Params #### Params
- **Object** `data`: The object passed to the `graph` method. - **Object** `data`: The object passed to the `graph` method.
- **Function** `callback`: The callback function. - **Function** `callback`: The callback function.
@ -112,6 +122,7 @@ Creates the calendar data for the provided period (default: *last year*).
Creates the ANSI contributions calendar. Creates the ANSI contributions calendar.
#### Params #### Params
- **Object** `options`: The object passed to the `calendar` method. - **Object** `options`: The object passed to the `calendar` method.
- **Function** `callback`: The callback function. - **Function** `callback`: The callback function.
@ -122,6 +133,7 @@ Creates the ANSI contributions calendar.
Creates an array with the authors of a git repository. Creates an array with the authors of a git repository.
#### Params #### Params
- **String|Object** `options`: The repo path or an object containing the following fields: - **String|Object** `options`: The repo path or an object containing the following fields:
- `repo` (String): The repository path. - `repo` (String): The repository path.
- **Function** `callback`: The callback function. - **Function** `callback`: The callback function.
@ -133,6 +145,7 @@ Creates an array with the authors of a git repository.
Creates the authors pie. Creates the authors pie.
#### Params #### Params
- **String|Object** `options`: The repo path or an object containing the following fields: - **String|Object** `options`: The repo path or an object containing the following fields:
- `repo` (String): The repository path. - `repo` (String): The repository path.
- `radius` (Number): The pie radius. - `radius` (Number): The pie radius.
@ -147,6 +160,7 @@ Creates the authors pie.
Creates the global contributions calendar (all commits made by all committers). Creates the global contributions calendar (all commits made by all committers).
#### Params #### Params
- **String|Object** `options`: The repo path or an object containing the following fields: - **String|Object** `options`: The repo path or an object containing the following fields:
- `repo` (String): The repository path. - `repo` (String): The repository path.
- `start` (String): The start date. - `start` (String): The start date.

View file

@ -1,9 +1,11 @@
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->
[![git-stats](http://i.imgur.com/Q7TQYHx.png)](#) [![git-stats](http://i.imgur.com/Q7TQYHx.png)](#)
# `$ git-stats` # `$ git-stats`
[![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [![Version](https://img.shields.io/npm/v/git-stats.svg)](https://www.npmjs.com/package/git-stats) [![Downloads](https://img.shields.io/npm/dt/git-stats.svg)](https://www.npmjs.com/package/git-stats) [![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [![Ask me anything](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/IonicaBizau/ama) [![Version](https://img.shields.io/npm/v/git-stats.svg)](https://www.npmjs.com/package/git-stats) [![Downloads](https://img.shields.io/npm/dt/git-stats.svg)](https://www.npmjs.com/package/git-stats)
> Local git statistics including GitHub-like contributions calendars. > Local git statistics including GitHub-like contributions calendars.
@ -230,13 +232,15 @@ g1.ansiCalendar({
}); });
``` ```
## :question: Get Help ## :question: Get Help
There are few ways to get help: There are few ways to get help:
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question. 1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
2. For bug reports and feature requests, open issues. :bug: 2. For bug reports and feature requests, open issues. :bug:
3. For direct and quick help from me, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket: 3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
## :memo: Documentation ## :memo: Documentation
@ -260,6 +264,7 @@ this takes time. You can integrate and use these projects in your applications *
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it: However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
- Starring and sharing the projects you like :rocket: - Starring and sharing the projects you like :rocket:
- [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book:
- [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea: - [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:
- [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone). - [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).
- **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6` - **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`