diff --git a/.circleci/config.yml b/.circleci/config.yml index 24a7798f..99f47e07 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,9 +58,6 @@ jobs: root: . paths: - packages/*/build/* - - run: - name: Format text - command: yarn format-text - run: name: Check for clean workspace command: | @@ -461,6 +458,12 @@ jobs: - image: circleci/node:10-buster steps: - checkout + - run: + name: Install shfmt + command: | + sudo wget https://github.com/mvdan/sh/releases/download/v3.2.1/shfmt_v3.2.1_linux_amd64 -O /usr/local/bin/shfmt + sudo chmod +x /usr/local/bin/shfmt + shfmt --version - run: name: Version information command: echo "node $(node --version)"; echo "yarn $(yarn --version)" @@ -480,4 +483,22 @@ jobs: paths: - ~/.cache/yarn - run: + name: Lint command: yarn lint + - run: + name: Format text + command: yarn format-text + - run: + name: Format shell scripts + command: yarn format-shell + - run: + name: Check for clean workspace + command: | + SOURCE_CHANGES=$(git status --porcelain) + if [[ -n "$SOURCE_CHANGES" ]]; then + echo "Error: repository contains changes." + echo "Showing 'git status' and 'git diff' for debugging now:" + git status + git diff + exit 1 + fi diff --git a/package.json b/package.json index 4cc74b49..200ef8aa 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "scripts": { "format": "lerna run format", "format-text": "prettier --write --prose-wrap always --print-width 80 \"./*.md\" && lerna run format-text", + "format-shell": "shfmt -w scripts packages", "lint": "lerna run lint", "lint-fix": "lerna run lint-fix", "test": "lerna run test", diff --git a/packages/proto-signing/scripts/define-proto.sh b/packages/proto-signing/scripts/define-proto.sh index 16735b8b..ac077ff0 100755 --- a/packages/proto-signing/scripts/define-proto.sh +++ b/packages/proto-signing/scripts/define-proto.sh @@ -1,13 +1,12 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" +command -v shellcheck >/dev/null && shellcheck "$0" TMP_DIR="./tmp" JS_SOURCE_FILE="$TMP_DIR/codecimpl.js" DEFINITIONS_FILE="$TMP_DIR/codecimpl.d.ts" OUTPUT_DIR="./src/codec/generated/" - yarn pbts "$JS_SOURCE_FILE" -o "$DEFINITIONS_FILE" # Remove comments after using them for the .d.ts # Note "When input files are specified on the command line, tsconfig.json files are ignored." (https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) diff --git a/packages/proto-signing/scripts/get-proto.sh b/packages/proto-signing/scripts/get-proto.sh index b9ff708c..64688843 100755 --- a/packages/proto-signing/scripts/get-proto.sh +++ b/packages/proto-signing/scripts/get-proto.sh @@ -1,6 +1,6 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" +command -v shellcheck >/dev/null && shellcheck "$0" PROTO_DIR="./proto" COSMOS_DIR="$PROTO_DIR/cosmos" diff --git a/packages/proto-signing/scripts/predefine-proto.sh b/packages/proto-signing/scripts/predefine-proto.sh index 2cc2f5b6..0f23dfc7 100755 --- a/packages/proto-signing/scripts/predefine-proto.sh +++ b/packages/proto-signing/scripts/predefine-proto.sh @@ -1,6 +1,6 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" +command -v shellcheck >/dev/null && shellcheck "$0" GENERATED_DIR="./tmp" ROOT_PROTO_DIR="./proto/cosmos/cosmos-sdk" diff --git a/packages/stargate/scripts/define-proto.sh b/packages/stargate/scripts/define-proto.sh index 16735b8b..ac077ff0 100755 --- a/packages/stargate/scripts/define-proto.sh +++ b/packages/stargate/scripts/define-proto.sh @@ -1,13 +1,12 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" +command -v shellcheck >/dev/null && shellcheck "$0" TMP_DIR="./tmp" JS_SOURCE_FILE="$TMP_DIR/codecimpl.js" DEFINITIONS_FILE="$TMP_DIR/codecimpl.d.ts" OUTPUT_DIR="./src/codec/generated/" - yarn pbts "$JS_SOURCE_FILE" -o "$DEFINITIONS_FILE" # Remove comments after using them for the .d.ts # Note "When input files are specified on the command line, tsconfig.json files are ignored." (https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) diff --git a/packages/stargate/scripts/get-proto.sh b/packages/stargate/scripts/get-proto.sh index b9ff708c..64688843 100755 --- a/packages/stargate/scripts/get-proto.sh +++ b/packages/stargate/scripts/get-proto.sh @@ -1,6 +1,6 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" +command -v shellcheck >/dev/null && shellcheck "$0" PROTO_DIR="./proto" COSMOS_DIR="$PROTO_DIR/cosmos" diff --git a/packages/stargate/scripts/predefine-proto.sh b/packages/stargate/scripts/predefine-proto.sh index 5c05e91c..d41d1632 100755 --- a/packages/stargate/scripts/predefine-proto.sh +++ b/packages/stargate/scripts/predefine-proto.sh @@ -1,6 +1,6 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" +command -v shellcheck >/dev/null && shellcheck "$0" GENERATED_DIR="./tmp" ROOT_PROTO_DIR="./proto/cosmos/cosmos-sdk" diff --git a/scripts/add_nonces.sh b/scripts/add_nonces.sh index bcc0e29e..aa89abc7 100755 --- a/scripts/add_nonces.sh +++ b/scripts/add_nonces.sh @@ -1,6 +1,6 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" +command -v shellcheck >/dev/null && shellcheck "$0" # This must be called from repo root as current directory @@ -10,7 +10,7 @@ for packagedir in ./packages/*; do if [[ -d "$packagedir" ]]; then mkdir -p "$packagedir/nonces" echo "Directory used to trigger lerna package updates for all packages" \ - > "$packagedir/nonces/README.txt" + >"$packagedir/nonces/README.txt" touch "$packagedir/nonces/$NONCE" echo "Added nonce to package $packagedir" fi diff --git a/scripts/docs/copy_docs.sh b/scripts/docs/copy_docs.sh index 0acd357b..359f0db2 100755 --- a/scripts/docs/copy_docs.sh +++ b/scripts/docs/copy_docs.sh @@ -1,6 +1,6 @@ #!/bin/bash set -o errexit -o nounset -o pipefail -command -v shellcheck > /dev/null && shellcheck "$0" +command -v shellcheck >/dev/null && shellcheck "$0" version="latest" out_dir="./docs_deployment" @@ -21,11 +21,11 @@ cp docs/cosmjs-tree.png "$assets_dir" echo '

Package documentation

' echo '

The following packages can be used as libraries.

' echo '