# node-git-info-json-extra

> This module outputs a `git.properties.json` file with some [git commit information](#sample-output).

Latest version **1.0.0** (published 2019-09-24) · 0 weekly downloads

## Install

```sh
npm install node-git-info-json-extra
pnpm add node-git-info-json-extra
yarn add node-git-info-json-extra
bun add node-git-info-json-extra
```

Provides the command `node-git-info-json-extra`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-09-24 |
| First published | 2018-05-31 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jim Moody |
| Maintainers | reeska |

## Links

- npm: https://www.npmjs.com/package/node-git-info-json-extra
- Repository: https://github.com/Reeska/node-git-info-json
- Issues: https://github.com/Reeska/node-git-info-json/issues
- npm.io page: https://npm.io/package/node-git-info-json-extra

## Dependencies (2)

- [command-line-args](https://npm.io/package/command-line-args.md) 3.0.3
- [child-process-promise](https://npm.io/package/child-process-promise.md) 2.2.0

## Recent versions

- 1.0.0 (latest) — 2019-09-24
- 0.1.2 — 2018-05-31
- 0.1.1 — 2018-05-31

## README

# Node Git Info JSON With Extra

This module outputs a `git.properties.json` file with some [git commit information](#sample-output).

It was created because we created a Node Express app with a `/info` endpoint that serves some git information.

## Usage

### Globally

```sh
npm i -g node-git-info-json-extra
node-git-info-json-extra [options]

-d, --directory # Directory to save the file to, default is the cwd
-f, --filename # Filename, default is git.properties.json
-e, --extra # Extra json to append to the generated file
```

### Project Level

1. Install as dev dependency

```sh
npm i -D node-git-info-json-extra
```

2. Add to `package.json` scripts, example below:

```json
{
  "scripts": {
    "git-info": "node-git-info-json-extra"
  }
}
```

3. Run script as part of npm command

```sh
npm run git-info
```

## Sample Output

`git.properties.json`

```json
{
  "buildTime": "Wed, 30 May 2018 09:54:53 GMT",
  "git": {
    "commit": {
      "message": {
        "full": "fake commit",
        "short": "fake commit"
      },
      "time": "Tue Jan 23 2018 15:46:45 GMT-0500 (EST)",
      "id": "af1fe75e2df23d1e93e884c6018d6f23dfee19c4",
      "abbrevId": "af1fe75",
      "user": {
        "email": "jimsmoody@gmail.com",
        "name": "JIM MOODY"
      }
    },
    "branch": "master"
  }
}
```

## Full example

```sh
mkdir dist
npx node-git-info-json-extra -d dist -f info.json -e '{"version": "1.2.3"}'
```

## Full Sample Output

`git.properties.json`

```json
{
  "version" : "1.2.3",
  "buildTime": "Wed, 30 May 2018 09:54:53 GMT",
  "git": {
    "commit": {
      "message": {
        "full": "fake commit",
        "short": "fake commit"
      },
      "time": "Tue Jan 23 2018 15:46:45 GMT-0500 (EST)",
      "id": "af1fe75e2df23d1e93e884c6018d6f23dfee19c4",
      "abbrevId": "af1fe75",
      "user": {
        "email": "jimsmoody@gmail.com",
        "name": "JIM MOODY"
      }
    },
    "branch": "master"
  }
}
```

## Acknowledgements

Basically a fork from the [node-git-info](https://www.npmjs.com/package/node-git-info) project but the output is a `.json` file instead of a `.properties` file which is much easier to parse in a Node project.

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