From 993d8ae06833971ddcbe3ad919fdc1df72d43c06 Mon Sep 17 00:00:00 2001 From: Maxime Thirouin Date: Mon, 11 Jan 2016 08:02:20 +0100 Subject: [PATCH] Avoid magical --rebase (2.0.0) https://github.com/sindresorhus/np/pull/7 https://github.com/sindresorhus/np/pull/8 --- CHANGELOG.md | 3 +++ npmpublish.sh | 16 +++++++++++++++- package.json | 7 +++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb42264..234ebf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ +# 2.0.0 - 2016-01-11 +- Changed: do not rebase by default, but instead show a warning if relevant. - Fixed: no more ``*-trash`` warnings (``trash`` replaced by ``trash-cli``). +- Added: show a warning if you have unstashed changes or remote is unreadable. # 1.0.0 - 2015-10-04 diff --git a/npmpublish.sh b/npmpublish.sh index 50b518a..b246b9b 100755 --- a/npmpublish.sh +++ b/npmpublish.sh @@ -1,5 +1,19 @@ #!/usr/bin/env sh -git pull --rebase && + +if test -n "$(git status --porcelain)"; then + echo 'Unclean working tree. Commit or stash changes first.' >&2; + exit 128; +fi + +if ! git fetch --quiet 2>/dev/null; then + echo 'There was a problem fetching your branch.' >&2; + exit 128; +fi + +if test "0" != "$(git rev-list --count --left-only @'{u}'...HEAD)"; then + echo 'Remote history differ. Please pull changes.' >&2; + exit 128; +fi # get the current real path of this file so we can relative node_modules # (in our case, trash-cli) diff --git a/package.json b/package.json index 38f9110..6b7cd14 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "npmpub", - "version": "1.0.0", + "version": "2.0.0", "description": "Another better `npm publish`", "keywords": [ "cli-app", @@ -8,7 +8,10 @@ "npm", "publish", "git", - "push" + "push", + "version", + "bump", + "commit" ], "author": "Maxime Thirouin", "license": "MIT",