Skip to content

Commit

Permalink
fix: Resolve package.json for version metadata regardless of nesting
Browse files Browse the repository at this point in the history
The package.json file appears at a different relative location in the source tree versus the compiled package.
It should be resolved regardless of the level of nesting present in the calling module.

Relates to #173
  • Loading branch information
Thorn1089 committed Apr 20, 2018
1 parent a2d64b7 commit db41b53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"consumer driven testing"
],
"author": "Matt Fellows <[email protected]> (http://twitter.com/matthewfellows)",
"contributors": [{
"contributors": [
{
"name": "Tarcio Saraiva",
"email": "[email protected]",
"url": "http://twitter.com/tarciosaraiva"
Expand Down Expand Up @@ -95,6 +96,7 @@
"lodash.isundefined": "3.0.1",
"lodash.omit": "^4.5.0",
"lodash.omitby": "4.6.0",
"packpath": "^0.1.0",
"popsicle": "^9.2.0"
},
"devDependencies": {
Expand Down
7 changes: 6 additions & 1 deletion src/common/logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import * as bunyan from "bunyan";
const PrettyStream = require("bunyan-prettystream");

const pkg = require("../../package.json");
const path = require("path");
const packpath = require("packpath");

// Look up package.json regardless of nesting
const manifestFile = path.join(packpath.self(), "package.json");
const pkg = require(manifestFile);
const prettyStdOut = new PrettyStream();
prettyStdOut.pipe(process.stdout);

Expand Down

0 comments on commit db41b53

Please sign in to comment.