Skip to content

Commit

Permalink
add 'make cutarelease' to publish new versions; use "files" for small…
Browse files Browse the repository at this point in the history
…er published package (#95)

Also drop some unnecessary Makefile goop.
The 'make cutarelease' task was copied from node-manta/Makefile with tweaks to make it work with /bin/sh that isn't ksh or bash.
  • Loading branch information
trentm committed Nov 5, 2019
1 parent dee0ee7 commit dde0188
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 83 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*.log
node_modules
/node_modules
6 changes: 4 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# node-http-signature changelog

## Not Yet Released
## not yet released

(nothing yet)

## 1.3.1

Expand Down Expand Up @@ -46,7 +48,7 @@

- First semver release.
- #36: Ensure verifySignature does not leak useful timing information
- #42: Bring the library up to the latest version of the spec (including the
- #42: Bring the library up to the latest version of the spec (including the
request-target changes)
- Support for ECDSA keys and signatures.
- Now uses `sshpk` for key parsing, validation and conversion.
Expand Down
63 changes: 35 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,51 +1,58 @@
#
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
# Copyright 2019 Joyent, Inc.
#
# Makefile: basic Makefile for template API service
#
# This Makefile is a template for new repos. It contains only repo-specific
# logic and uses included makefiles to supply common targets (javascriptlint,
# jsstyle, restdown, etc.), which are used by other repos as well. You may well
# need to rewrite most of this file, but you shouldn't need to touch the
# included makefiles.
#
# If you find yourself adding support for new targets that could be useful for
# other projects too, you should add these to the original versions of the
# included Makefiles (in eng.git) so that other teams can use them too.
#

#
# Tools
#
NPM_EXEC := npm
TAP := ./node_modules/.bin/tap

#
# Files
#
JS_FILES := $(shell find lib -name '*.js')
JSL_CONF_NODE = tools/jsl.node.conf
JSL_FILES_NODE = $(JS_FILES)
JSSTYLE_FILES = $(JS_FILES)
JSSTYLE_FLAGS = -f tools/jsstyle.conf


# This, and the includes below, provide: 'make check' and 'make clean'.
include ./tools/mk/Makefile.defs
include ./tools/mk/Makefile.node_deps.defs


#
# Repo-specific targets
#
.PHONY: all
all: $(REPO_DEPS)
$(NPM_EXEC) install
npm install

CLEAN_FILES += $(TAP) ./node_modules/tap
CLEAN_FILES += ./node_modules

.PHONY: test
test: all
TAP=1 $(TAP) test/*.test.js
TAP=1 ./node_modules/.bin/tap test/*.test.js

# Ensure CHANGES.md and package.json have the same version.
.PHONY: check-version
check-version:
@echo version is: $(shell cat package.json | json version)
[ "`cat package.json | json version`" = "`grep '^## ' CHANGES.md | head -2 | tail -1 | awk '{print $$2}'`" ]

check: check-version

.PHONY: cutarelease
cutarelease: $(COMPLETION_FILE) check-version
[ -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 "v$$ver" -m "version $$ver ($$date)" && \
git push --tags origin && \
npm publish


include ./tools/mk/Makefile.deps
include ./tools/mk/Makefile.node_deps.targ
include ./tools/mk/Makefile.targ
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"node": ">=0.10"
},
"main": "lib/index.js",
"files": [
"lib"
],
"scripts": {
"test": "tap test/*.js"
},
Expand Down
35 changes: 0 additions & 35 deletions tools/mk/Makefile.node_deps.defs

This file was deleted.

16 changes: 0 additions & 16 deletions tools/mk/Makefile.node_deps.targ

This file was deleted.

0 comments on commit dde0188

Please sign in to comment.