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

Commit 38455ae

Browse files
committed
added path
1 parent 7f34aae commit 38455ae

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

index.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ const readPkgUp = require('read-pkg-up')
55
const writePkg = require('write-pkg')
66
const chalk = require('chalk')
77
const options = require('minimist')(process.argv.slice(2))
8+
const path = require('path')
89

910
// don't normalize package.json
10-
readPkgUp({normalize:false}).then(result => {
11+
readPkgUp({normalize:false})
12+
.then(result => {
1113
let {pkg} = result
1214
const pkgPath = result.path
15+
const gitPath = path.dirname(pkgPath)
16+
1317
const gitInfo = {
14-
short: git.short(process.cwd()),
15-
long: git.long(process.cwd()),
16-
branch: git.branch(process.cwd())
18+
short: git.short(gitPath),
19+
long: git.long(gitPath),
20+
branch: git.branch(gitPath)
1721
}
1822

1923
const updatedPkg = Object.assign({}, pkg, {
@@ -31,13 +35,4 @@ Branch: ${chalk.red(gitInfo.branch)}`
3135
console.log(logMsg)
3236
}
3337
})
34-
// fs.writeFile(filepath, result, 'utf8' (writeErr) => {
35-
// if (writeErr) {
36-
// throw new Error(writeErr)
37-
// }
38-
//
39-
// if (options.v || options.verbose) {
40-
// console.log(chalk.green())
41-
// }
42-
// })
4338
})

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"write-pkg": "^3.1.0"
4141
},
4242
"git": {
43-
"short": "01bebd7",
44-
"long": "01bebd765a5a83247c96c299e4c5a216e84a122e",
43+
"short": "7f34aae",
44+
"long": "7f34aaee224ab6bd2feaf4e0a7f42bffc973ab06",
4545
"branch": "master"
4646
}
4747
}

0 commit comments

Comments
 (0)