From 651ce9974166f681b7c19834a0d7aee7afe8bbd5 Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Thu, 8 Jun 2017 14:27:39 -0300 Subject: [PATCH] [chore] prevent publish if an error occur. --- Makefile | 14 +++++++++----- bootstrap.sh | 36 ++++++++++++++++++++++++++++++++++++ scripts/version | 5 +++++ 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 bootstrap.sh diff --git a/Makefile b/Makefile index 6dcc6002..81a94ab1 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,12 @@ info: @echo jq version: `$(JQ) --version` "($(JQ))" @echo react-modal version: $(VERSION) -deps: +deps: deps-project deps-docs + +deps-project: @[[ ! -z "$(YARN)" ]] && $(YARN) install || $(NPM) install + +deps-docs: @gitbook install # Rules for development @@ -52,7 +56,7 @@ build: build-docs: @echo "[Building documentation]" - @rm -rf _book/* + @rm -rf _book @gitbook build -g reactjs/react-modal version: @@ -78,12 +82,12 @@ publish-version: release-commit release-tag npm publish @rm .version -publish: version build publish-version publish-finished +publish: version deps-project build publish-version publish-finished -publish-docs: build-docs +publish-docs: deps-docs build-docs @echo "[Publishing docs]" + git init _book cd _book - git init git commit --allow-empty -m 'update book' git checkout -b gh-pages touch .nojekyll diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 00000000..70fc3326 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +NODE=`which node` +NPM=`which npm` +YARN=`which yarn` +JQ=`which jq` + +echo $NODE $NPM $YARN $JQ + +if [[ ! -z "$NODE" ]]; then + echo "Node is installed and it's version is: `$NODE --version`" +else + echo "Please, install node.js." + exit 1 +fi + +if [[ ! -z "$NPM" ]]; then + echo "NPM is installed and it's version is: `$NPM --version`" +else + echo "Please, install npm." + exit 1 +fi + +if [[ ! -z "$YARN" ]]; then + echo "yarn is installed and it's version is: `$YARN --version`" +else + echo "yarn is optional." +fi + +if [[ ! -z "$JQ" ]]; then + echo "jq is installed and it's version is: `$JQ --version`" +else + echo "jq is optional and used only for publish purpose." +fi + +npm install -g gitbook-cli diff --git a/scripts/version b/scripts/version index 4e16838d..45710799 100644 --- a/scripts/version +++ b/scripts/version @@ -10,6 +10,11 @@ echo "Current version is: $1" read -p "Bump to: " NEW_VERSION +if [[ ! -z "$(git tag -l | grep v${NEW_VERSION})" ]]; then + echo "Tag $NEW_VERSION already exists." + exit 1 +fi + FILES="package.json bower.json" for F in $FILES; do