# git-log-json

> Simple tool to get a JSON from your git log.

Latest version **1.4.3** (published 2021-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-log-json
pnpm add git-log-json
yarn add git-log-json
bun add git-log-json
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.3 |
| Published | 2021-11-08 |
| First published | 2021-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 122.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | JD-Wang |
| Maintainers | jd-wang |
| Keywords | git, json, log |

## Links

- npm: https://www.npmjs.com/package/git-log-json
- Repository: https://github.com/JD-Wang/git2json
- Homepage: https://github.com/JD-Wang/git2json#readme
- Issues: https://github.com/JD-Wang/git2json/issues
- npm.io page: https://npm.io/package/git-log-json

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.4.3 (latest) — 2021-11-08
- 1.4.2 — 2021-11-08
- 1.4.1 — 2021-10-22
- 1.4.0 — 2021-10-20

## README

# git-log-json

>Frok from [git2json](https://github.com/fabien0102/git2json)

Simple tool to get a JSON from your git log.

## CLI usage

1. Install package globally -> `npm i -g git-log-json` or `yarn global add git-log-json`
1. Navigate to your local git repository folder
1. Do `git2json > export.json`
1. Voilà!

## Lib usage

1. Add dependency -> `npm i -s git-log-json` or `yarn add git-log-json`
1. Use it!

```javascript
import git2json from 'git-log-json'

git2json
  .run()
  .then(myGitLogJSON => console.log(myGitLogJSON));
```

## Advanced usage

If needed, you have access to `parsers` and `defaultFields` for easy overriding.

Example:

```javascript
import git2json from 'git-log-json'
const exportedFields = {
  author: git2json.defaultFields['author.name'],
  commit: git2json.defaultFields.commit,
  shortTree: { value: '%T', parser: a => a.slice(0, 5)}
};

git2json
  // more extra like
  // extraLogOptions: ['v1.0.0..v3.0.0'] 
  .run({fields: exportedFields}, extraLogOptions: []) 
  .then(json => console.log(json));
```

You can also specify a path, or paths, for the git repository. Just like the above options, doing so is optional with sane defaults. Multiple paths results in a flattened combined log output.

Example specifying `path`:

```javascript
import git2json from 'git-log-json'
const path = '~/src/hack/git2json';

git2json
  .run({ path })
  .then(console.log);
```

Example specifying `paths`:

```javascript
import git2json from 'git-log-json'
const paths = ['~/etc', '~/src/hack/git2json'];

git2json
  .run({ paths })
  .then(console.log);
```

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