Skip to content

Commit

Permalink
get lib and cli to get version from package.json so bumping version i…
Browse files Browse the repository at this point in the history
…sn't so much of a PITA
  • Loading branch information
trentm committed Aug 2, 2017
1 parent 11e26ec commit c093219
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ all $(NODEUNIT):
versioncheck:
@echo version is: $(shell cat package.json | json version)
[[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -2 | tail -1 | awk '{print $$2}'` ]]
[[ `cat package.json | json version` == `grep '^var VERSION' bin/bunyan | awk -F"'" '{print $$2}'` ]]
[[ `cat package.json | json version` == `grep '^var VERSION' lib/bunyan.js | awk -F"'" '{print $$2}'` ]]
@echo Version check ok.

.PHONY: cutarelease
Expand Down
8 changes: 5 additions & 3 deletions bin/bunyan
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* vim: expandtab:ts=4:sw=4
*/

var VERSION = '2.0.1';

var p = console.log;
var util = require('util');
var pathlib = require('path');
Expand Down Expand Up @@ -134,8 +132,12 @@ var stdout = process.stdout;

//---- support functions

var _version = null;
function getVersion() {
return VERSION;
if (_version === null) {
_version = require('../package.json').version;
}
return _version;
}


Expand Down
4 changes: 1 addition & 3 deletions lib/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* vim: expandtab:ts=4:sw=4
*/

var VERSION = '2.0.1';

/*
* Bunyan log format version. This becomes the 'v' field on all log records.
* This will be incremented if there is any backward incompatible change to
Expand Down Expand Up @@ -1611,7 +1609,7 @@ module.exports.resolveLevel = resolveLevel;
module.exports.levelFromName = levelFromName;
module.exports.nameFromLevel = nameFromLevel;

module.exports.VERSION = VERSION;
module.exports.VERSION = require('../package.json').version;
module.exports.LOG_VERSION = LOG_VERSION;

module.exports.createLogger = function createLogger(options) {
Expand Down

0 comments on commit c093219

Please sign in to comment.