get lib and cli to get version from package.json so bumping version isn't so much of a PITA

master
Trent Mick 2017-08-02 16:56:22 -07:00
parent 11e26ecf55
commit c0932196dd
3 changed files with 6 additions and 8 deletions

View File

@ -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

View File

@ -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');
@ -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;
}

View File

@ -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
@ -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) {