Skip to content

Commit 0032eb4

Browse files
authored
docs: update README.md (#50)
* docs: update README.md * docs(README): upgrade supported node version
1 parent ff7e09b commit 0032eb4

File tree

1 file changed

+52
-50
lines changed

1 file changed

+52
-50
lines changed

README.md

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,92 @@
1-
# Git-Parse
1+
Git-Parse
2+
=========
23

3-
`git-parse` is a utility which generates an array of javascript objects representing the current branch of a local git repository's commit history.
4+
[![NPM version](https://img.shields.io/npm/v/git-parse.svg)](https://www.npmjs.com/package/git-parse)
5+
[![NPM Downloads](https://img.shields.io/npm/dm/git-parse.svg?style=flat)](https://www.npmjs.org/package/git-parse)
6+
[![Bundlephobia](https://badgen.net/bundlephobia/minzip/git-parse)](https://bundlephobia.com/result?p=git-parse)
47

5-
## Getting Started
8+
> `git-parse` is a utility which generates an array of javascript objects representing the current branch of a local git repository's commit history.
69
7-
### Prerequisites
10+
### Details
811

9-
```
10-
nodejs version 14 or higher
11-
```
12+
- Support NodeJS >= 14
1213

1314
### Installation
1415

15-
```
16-
npm i git-parse
16+
```bash
17+
npm install git-parse
1718
```
1819

1920
### Usage
2021

21-
```
22+
```js
2223
const { gitToJs } = require('git-parse');
2324

2425
const commitsPromise = gitToJs('path/to/repo/');
2526

2627
commitsPromise.then(commits => console.log(JSON.stringify(commits, null, 2)));
27-
2828
```
2929

30-
**Console Output:**
31-
32-
```
33-
[
34-
{
35-
"hash":"7cedc121ee163d859dfdb9911e627d4b5933cc6d",
36-
"authorName":"[email protected]",
37-
"authorEmail":"[email protected]",
38-
"date":"Wed, 10 Jan 2018 16:44:52 -0500",
39-
"message":"initial setup",
40-
"filesAdded":[
41-
{ "path":"packages/raspberry-popsicle/index.js" },
42-
{ "path":"packages/raspberry-popsicle/package-lock.json" },
43-
{ "path":"packages/raspberry-popsicle/package.json" }
44-
],
45-
"filesDeleted":[ ],
46-
"filesModified":[ ],
47-
"filesRenamed":[ ]
48-
},
49-
{
50-
"hash": "226f032eb87ac1eb18b7212eeaf1356980a9ae03",
51-
"authorName": "[email protected]",
52-
"authorEmail": "[email protected]",
53-
"date": "Wed, 10 Jan 2018 15:25:16 -0500",
54-
"message": "add README",
55-
"filesAdded": [
56-
{ "path": "README.md" }
57-
],
58-
"filesDeleted": [],
59-
"filesModified": [],
60-
"filesRenamed": []
61-
}
62-
]
63-
```
30+
<details>
31+
<summary><b>Console output:</b></summary>
32+
33+
```json
34+
[
35+
{
36+
"hash": "7cedc121ee163d859dfdb9911e627d4b5933cc6d",
37+
"authorName": "[email protected]",
38+
"authorEmail": "[email protected]",
39+
"date": "Wed, 10 Jan 2018 16:44:52 -0500",
40+
"message": "initial setup",
41+
"filesAdded":[
42+
{ "path": "packages/raspberry-popsicle/index.js" },
43+
{ "path": "packages/raspberry-popsicle/package-lock.json" },
44+
{ "path": "packages/raspberry-popsicle/package.json" }
45+
],
46+
"filesDeleted": [],
47+
"filesModified": [],
48+
"filesRenamed": []
49+
},
50+
{
51+
"hash": "226f032eb87ac1eb18b7212eeaf1356980a9ae03",
52+
"authorName": "[email protected]",
53+
"authorEmail": "[email protected]",
54+
"date": "Wed, 10 Jan 2018 15:25:16 -0500",
55+
"message": "add README",
56+
"filesAdded": [
57+
{ "path": "README.md" }
58+
],
59+
"filesDeleted": [],
60+
"filesModified": [],
61+
"filesRenamed": []
62+
}
63+
]
64+
```
65+
</details>
6466

6567
## API
6668

67-
### gitToJs(pathToRepo, [options])
69+
### .gitToJs(pathToRepo, [options])
6870

6971
Returns a promise which resolves with a list of objects describing git commits on the current branch. `pathToRepo` is a string. `options` is an optional object with one property, `sinceCommit`, which is a commit hash. If `sinceCommit` is present, gitToJs will return logs for commits _after_ the commit specified.
7072

71-
```
73+
```js
7274
const { gitToJs } = require('git-parse');
7375

7476
const commitsPromise = gitToJs('path/to/repo/');
7577

7678
commitsPromise.then(commits => console.log(JSON.stringify(commits, null, 2)));
7779
```
7880

79-
### checkOutCommit(pathToRepo, commitHash, [options])
81+
### .checkOutCommit(pathToRepo, commitHash, [options])
8082

8183
Checks a repository out to a given commit. `hash` is the commit hash. Options is an optional object with one property, `force`. `force` adds `--force` to the [underlying git checkout](https://git-scm.com/docs/git-checkout#git-checkout--f). Returns a promise.
8284

83-
### gitPull(pathToRepo)
85+
### .gitPull(pathToRepo)
8486

8587
Runs 'git pull' on the repository at the given path. Returns a promise.
8688

87-
### gitDiff(pathToRepo, commitHash1, [commitHash2], [file])
89+
### .gitDiff(pathToRepo, commitHash1, [commitHash2], [file])
8890

8991
Returns a git diff given a path to the repo, a commit, an optional second commit, and an optional file path.
9092

0 commit comments

Comments
 (0)