Skip to content

Commit

Permalink
version: use readPackage helper
Browse files Browse the repository at this point in the history
PR-URL: npm#10717
Credit: @ekmartin
  • Loading branch information
ekmartin authored and zkat committed Jan 14, 2016
1 parent 8b593d8 commit f10d300
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,7 @@ function version (args, silent, cb_) {
}
if (args.length > 1) return cb_(version.usage)

var packagePath = path.join(npm.localPrefix, 'package.json')
fs.readFile(packagePath, function (er, data) {
if (data) data = data.toString()
try {
data = parseJSON(data)
} catch (e) {
er = e
data = null
}

readPackage(function (er, data) {
if (!args.length) return dump(data, cb_)

if (er) {
Expand Down

0 comments on commit f10d300

Please sign in to comment.