From a41539bfbda0eb1a702960ba26b3dd145f8e5d2f Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Mon, 17 Oct 2016 16:30:55 -0700 Subject: [PATCH] change 'make cutarelease' style to not do autocommits and version bumping as part of releasing --- CHANGES.md | 6 +++++- Makefile | 25 ++++++++++++++++++++----- lib/bunyan.js | 4 ++-- tools/timeguard.js | 1 + 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4d7c67a..0457d00 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,9 +5,13 @@ Known issues: - [issue #58] Can't install to a dir with spaces. This is [this node-gyp bug](https://github.com/TooTallNate/node-gyp/issues/65). +## not yet released -## 1.8.2 (not yet released) +## 1.8.2 + +- [issue #449] Bump dtrace-provider dep to 0.7.0 to help avoid deprecation + warnings with node v6 in some cases. - [issue #426] Ensure `log.info({err: err})` results in a "msg" value, just like `log.info(err)`. diff --git a/Makefile b/Makefile index 81c9ac0..ba0959e 100644 --- a/Makefile +++ b/Makefile @@ -35,15 +35,30 @@ all $(NODEUNIT): .PHONY: versioncheck versioncheck: @echo version is: $(shell cat package.json | json version) - [[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -1 | awk '{print $$2}'` ]] + [[ `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 -cutarelease: versioncheck check - [[ `git status | tail -n1 | cut -c1-17` == "nothing to commit" ]] - ./tools/cutarelease.py -p bunyan -f package.json -f lib/bunyan.js -f bin/bunyan +cutarelease: check + [[ -z `git status --short` ]] # If this fails, the working dir is dirty. + @which json 2>/dev/null 1>/dev/null && \ + ver=$(shell json -f package.json version) && \ + name=$(shell json -f package.json name) && \ + publishedVer=$(shell npm view -j $(shell json -f package.json name)@$(shell json -f package.json version) version 2>/dev/null) && \ + if [[ -n "$$publishedVer" ]]; then \ + echo "error: $$name@$$ver is already published to npm"; \ + exit 1; \ + fi && \ + echo "** Are you sure you want to tag and publish $$name@$$ver to npm?" && \ + echo "** Enter to continue, Ctrl+C to abort." && \ + read + ver=$(shell cat package.json | json version) && \ + date=$(shell date -u "+%Y-%m-%d") && \ + git tag -a "$$ver" -m "version $$ver ($$date)" && \ + git push --tags origin && \ + npm publish .PHONY: docs docs: toc @@ -121,7 +136,7 @@ check-jsstyle: $(JSSTYLE_FILES) ./tools/jsstyle -o indent=4,doxygen,unparenthesized-return=0,blank-after-start-comment=0,leading-right-paren-ok=1 $(JSSTYLE_FILES) .PHONY: check -check: check-jsstyle +check: check-jsstyle versioncheck @echo "Check ok." .PHONY: prepush diff --git a/lib/bunyan.js b/lib/bunyan.js index 0817054..47a15d7 100644 --- a/lib/bunyan.js +++ b/lib/bunyan.js @@ -980,8 +980,8 @@ function mkLogEmitter(minLevel) { msgArgs[0] = util.inspect(msgArgs[0]); } else { // `log.(fields, msg, ...)` fields = args[0]; - if (args.length === 1 && fields.err - && fields.err instanceof Error) + if (args.length === 1 && fields.err && + fields.err instanceof Error) { msgArgs = [fields.err.message]; } else { diff --git a/tools/timeguard.js b/tools/timeguard.js index c723d4b..dc1ca06 100755 --- a/tools/timeguard.js +++ b/tools/timeguard.js @@ -32,6 +32,7 @@ fields = { ms = ben(1e5, function () { log.info(fields, 'hi'); }); console.log(' - log.info with medium fields: %dms per iteration', ms); +// JSSTYLED fields = {"name":"cloudapi","hostname":"5bac70c2-fad9-426d-99f1-2854efdad922","pid":53688,"component":"audit","audit":true,"level":30,"remoteAddress":"172.25.1.28","remotePort":49596,"req_id":"574e5560-6a9d-11e6-af76-3dadd30aa0da","req":{"method":"POST","url":"/my/machines","headers":{"host":"cloudapi.nightly-1.joyent.us","user-agent":"curl/7.42.0","accept":"application/json","content-type":"application/json","x-api-version":"~7","authorization":"Signature keyId=\"/admin/keys/64:86:e3:ef:0a:76:bc:43:02:8c:02:04\",algorithm=\"rsa-sha256\" PJmFgjoiW/+MqhYyzjtckFptmcFrHqV1zuETRh+hv8ApxyKZ/+xO6G8q4PPNDxfbhAsP6/kKrV7DJklyIn0KunkyHbonAUGuUb4eq0CghmVX0jwma2ttdvNB2n8k3rvUDlQXp+X/Bi2PNj7D1zjcBQlkRhx118JTtR+QZp+bdTrJ+g6lIs1CMPnRHEQkGOYw3mjDjRNwPiPqcQPmGj7qY/DW0lEfIj/41z7dWS6vUA50RrV1EeM1hD7VCKYZAC41hFC/VLSG1Lbhq7gTykZ3QjM0WyOaDX06cKWxdS+x4VveyvFMVUaiGCeiWpOXmbiLbGomII2AR8NK1+LWfaqH4C31y0bjZ+iK7SBMQ+XY3QjlFv/di3CdlEylUKXsJoKxGqhuCzg+7eXzCNqMj5tdvOdKwizPpazwzPbjAyDeU2l8dTwggMQSuLy7qC7UVtRN2AUgWxw8fxGqivnmbGfRE+KFxA+VrizG+DLFQBve/bd3ZQvKmS/HKM1ATomYyW9g7W8Z2lKbmPtbv91A77bLRh7f6OA2fwaBPW3HP89adC2Gsyj+0sCcPq3F+r/lAT3gEw+tuVBlBbJsS1IV19FQAl0ajCd9ZJ/mJMPGt5hLwbVA7mU6yyU5J71elaBs6klmaKBNPesGLBSv55/xnZlU6mS9FXPdC5Sg=","date":"Thu, 25 Aug 2016 08:24:28 GMT","content-length":"184","x-forwarded-for":"::ffff:172.25.1.28"},"httpVersion":"1.1","trailers":{},"timers":{"parseAccept":743,"parseAuthorization":2051,"parseDate":20,"parseQueryString":50,"bunyan":79,"readBody":1699,"parseBody":218,"restifyResponseHeaders":9,"xForwardedFor":108,"setupSDCProxies":18,"accountMgmt":114,"signatureAuth":182865,"tokenAuth":42,"assertAuthenticated":15,"loadAccount":56,"resourceName":55,"loadDatasets":10765,"loadPackages":9280}},"res":{"statusCode":404,"headers":{"content-type":"application/json","content-length":99,"access-control-allow-origin":"*","access-control-allow-headers":"Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time","access-control-allow-methods":"POST, GET, HEAD","access-control-expose-headers":"Api-Version, Request-Id, Response-Time","connection":"Keep-Alive","content-md5":"O3boRcASC7JNu/huA6qnPw==","date":"Thu, 25 Aug 2016 08:24:29 GMT","server":"Joyent Triton 8.0.2","api-version":"8.0.0","request-id":"574e5560-6a9d-11e6-af76-3dadd30aa0da","response-time":210},"trailer":false},"err":{"message":"Package 92e2b20a-0c37-11e3-9605-63a778146273 does not exist","name":"ResourceNotFoundError","stack":"ResourceNotFoundError: Package 92e2b20a-0c37-11e3-9605-63a778146273 does not exist\n at parseResponse (/opt/smartdc/cloudapi/node_modules/sdc-clients/node_modules/restify/lib/clients/json_client.js:67:23)\n at IncomingMessage.done (/opt/smartdc/cloudapi/node_modules/sdc-clients/node_modules/restify/lib/clients/string_client.js:151:17)\n at IncomingMessage.g (events.js:180:16)\n at IncomingMessage.emit (events.js:117:20)\n at _stream_readable.js:944:16\n at process._tickDomainCallback (node.js:502:13)"},"latency":210,"route":"createmachine","_audit":true,"msg":"handled: 404","time":"2016-08-25T08:24:29.063Z","v":0}; ms = ben(1e5, function () { log.info(fields, 'hi'); }); console.log(' - log.info with large fields: %dms per iteration', ms);