Support git bash

This commit is contained in:
alandefreitas
2023-11-17 13:56:49 -03:00
committed by Alan de Freitas
parent 333e603231
commit e792a6b3c8
2 changed files with 10 additions and 2 deletions

View File

@@ -7,7 +7,9 @@ if [ -z "$npm_version" ]; then
echo "npm is not installed"
exit 1
fi
# Add node_modules/.bin to path
PATH=$(pwd)/node_modules/.bin:$PATH
export PATH
gulp_version=$(gulp --version 2>/dev/null)
if [ -z "$gulp_version" ]; then
echo "gulp is not installed"

View File

@@ -20,13 +20,16 @@ if [ -z "$node_version" ]; then
echo "Node.js is not installed"play
exit 1
fi
major_version=$(echo $node_version | egrep -o "v([0-9]+)\." | cut -c 2- | rev | cut -c 2- | rev)
# major_version=$(echo $node_version | egrep -o "v([0-9]+)\." | cut -c 2- | rev | cut -c 2- | rev)
major_version=$(echo "$node_version" | awk -F. '{print $1}' | cut -c 2-)
if [ "$major_version" -lt "16" ]; then
echo "Node.js version $node_version is not supported. Please upgrade to version 16 or higher."
node_path=$(which node)
echo "node_path=${node_path}"
fi
# Check if antora is available
PATH=$(pwd)/node_modules/.bin:$PATH
antora_version=$(antora --version 2>/dev/null)
if [ -n "$antora_version" ]; then
ANTORA_CMD='antora'
@@ -40,6 +43,7 @@ else
fi
fi
# Build UI if we have to
cwd=$(pwd)
script_dir=$(dirname "$(readlink -f "$0")")
if ! [ -e "$script_dir/antora-ui/build/ui-bundle.zip" ] || \
@@ -50,6 +54,7 @@ then
cd "$cwd" || exit
fi
# Identify current commit id for footer
if command -v git >/dev/null && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
commit_id=$(git rev-parse HEAD)
commit_id=$(expr substr "$commit_id" 1 7)
@@ -57,6 +62,7 @@ else
commit_id=""
fi
# Install node modules if needed
if [ ! -d "node_modules" ] || [ "$(find package.json -prune -printf '%T@\n' | cut -d . -f 1)" -gt "$(find node_modules -prune -printf '%T@\n' | cut -d . -f 1)" ]; then
npm ci
fi