Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit e828c1e

Browse files
committed
docs(readme.md): update readme.md
1 parent 9685320 commit e828c1e

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# git-hash-package
22

3+
### What does it do?
4+
This package gets info about your git repo (*long hash* + *short hash* + *branch*) and stores this data in your `package.json`.
5+
6+
### Why?
7+
I faced next issue:
8+
If we can't use `git log` inside Docker container in git subrepo in production, we need to store info about git in local files. Storing info about the current git state in `package.json` was a good decision.
9+
This module solves my issue.
10+
311
### Install
12+
```bash
13+
npm i git-hash-package
14+
```
15+
16+
Or if you want to run it globally(I haven't tested it yet):
17+
18+
```
19+
npm i -g git-hash-package
20+
```
421

522
### Usage
23+
```bash
24+
git-hash-package # run
25+
git-hash-package --verbose # run with verbose output about current git state (short + long hashes + branch)
26+
```
27+
28+
### Author
29+
Vladimir Metnew <vladimirmetnew@gmail.com>
30+
31+
### License
32+
MIT

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const writePkg = require('write-pkg')
66
const chalk = require('chalk')
77
const options = require('minimist')(process.argv.slice(2))
88

9-
readPkgUp().then(result => {
9+
// don't normalize package.json
10+
readPkgUp({normalize:false}).then(result => {
1011
let {pkg} = result
1112
const pkgPath = result.path
1213
const gitInfo = {
@@ -15,9 +16,6 @@ readPkgUp().then(result => {
1516
branch: git.branch()
1617
}
1718

18-
delete pkg.readme
19-
delete pkg._id
20-
2119
const updatedPkg = Object.assign({}, pkg, {
2220
git: gitInfo
2321
})

0 commit comments

Comments
 (0)