From 0ad434a69a6719952ee9ea8109609187d7e6128f Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Fri, 23 Nov 2018 16:58:17 +0100 Subject: [PATCH 1/6] Add some version checks to setup script There are some distros out there, shipping quite outdated packages with them, which results in weird issues. Let's check that we have a more or less up to date version of node and yarn installed. This patch adds those checks and this way should provide some helpful error messages to people who try to install CodiMD. Signed-off-by: Sheogorath --- bin/setup | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/bin/setup b/bin/setup index 2fcc65d64..0a48ba8ca 100755 --- a/bin/setup +++ b/bin/setup @@ -2,6 +2,8 @@ set -e +version_lt() { test "$(printf '%s\n' "$@" | { [ "$(uname)" = "Linux" ] && sort -V || sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n; } | tail -n 1)" != "$1"; } + # run command at repo root CURRENT_PATH=$PWD if [ -d .git ]; then @@ -16,7 +18,23 @@ Read more on Node.js official website: https://nodejs.org And for yarn package manager at: https://yarnpkg.com/en/ Setup will not be run EOF - exit 0 + exit 1 +fi + +if version_lt "$(yarn --version)" '1.3.2'; then + cat < Date: Tue, 17 Nov 2020 20:39:50 +0100 Subject: [PATCH 2/6] Update checks for correct Node.js and Yarn versions Signed-off-by: David Mehren --- bin/setup | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/setup b/bin/setup index 0a48ba8ca..c73aeeea8 100755 --- a/bin/setup +++ b/bin/setup @@ -21,18 +21,22 @@ EOF exit 1 fi -if version_lt "$(yarn --version)" '1.3.2'; then +if version_lt "$(yarn --version)" '1.22.0'; then cat < Date: Tue, 17 Nov 2020 20:32:30 +0100 Subject: [PATCH 3/6] Prettify messages in setup script Signed-off-by: David Mehren --- bin/setup | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/setup b/bin/setup index c73aeeea8..238b42e9e 100755 --- a/bin/setup +++ b/bin/setup @@ -13,10 +13,11 @@ fi if ! type yarn > /dev/null then cat << EOF -yarn is not installed, please install Node.js, npm and yarn. -Read more on Node.js official website: https://nodejs.org -And for yarn package manager at: https://yarnpkg.com/en/ -Setup will not be run +FATAL: Yarn could not be found. + +Please follow the official installation instructions at +https://classic.yarnpkg.com/en/docs/install +and try again. EOF exit 1 fi @@ -25,7 +26,7 @@ if version_lt "$(yarn --version)" '1.22.0'; then cat < Date: Tue, 17 Nov 2020 20:53:58 +0100 Subject: [PATCH 4/6] Improve wording of yarn version error in setup script Signed-off-by: David Mehren --- bin/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/setup b/bin/setup index 238b42e9e..926c8cbca 100755 --- a/bin/setup +++ b/bin/setup @@ -26,7 +26,7 @@ if version_lt "$(yarn --version)" '1.22.0'; then cat < Date: Tue, 17 Nov 2020 21:22:48 +0100 Subject: [PATCH 5/6] Fix shellcheck error in bin/setup Signed-off-by: David Mehren --- bin/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/setup b/bin/setup index 926c8cbca..0cd46b832 100755 --- a/bin/setup +++ b/bin/setup @@ -2,7 +2,7 @@ set -e -version_lt() { test "$(printf '%s\n' "$@" | { [ "$(uname)" = "Linux" ] && sort -V || sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n; } | tail -n 1)" != "$1"; } +version_lt() { test "$(printf '%s\n' "$@" | { [ "$(uname)" = "Linux" ] && (sort -V || sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n;) } | tail -n 1)" != "$1"; } # run command at repo root CURRENT_PATH=$PWD From ac7dd2982f53de30f428b57edf54c225b4bd91c5 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Tue, 17 Nov 2020 21:29:54 +0100 Subject: [PATCH 6/6] Fix inconsistent spacing in bin/setup Signed-off-by: David Mehren --- bin/setup | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/setup b/bin/setup index 0cd46b832..0f1edca0a 100755 --- a/bin/setup +++ b/bin/setup @@ -10,8 +10,7 @@ if [ -d .git ]; then cd "$(git rev-parse --show-toplevel)" fi -if ! type yarn > /dev/null -then +if ! type yarn > /dev/null; then cat << EOF FATAL: Yarn could not be found. @@ -23,7 +22,7 @@ EOF fi if version_lt "$(yarn --version)" '1.22.0'; then - cat <