@@ -95,46 +95,64 @@ echo "🧹 Cleaning documentation folder"
9595rm -rf ${DOCS_FOLDER}/*
9696'''
9797
98- [tasks .check-prerequisites ]
99- description = " Check prerequisites "
98+ [tasks .check-npx ]
99+ description = " Check npx is installed "
100100script = '''
101- echo "🔍 Checking prerequisites"
101+ if ! which npx >/dev/null; then
102+ echo "❌ npx could not be found"
103+ echo " Consider installing npx with: npm install -g npx"
104+ exit 1
105+ fi
106+ '''
102107
103- echo "❔ Checking \`npx\` installed..."
104- if ! which npx >/dev/null;
105- then
106- echo "\n❌ npx could not be found"
107- echo " Consider installing npx.\n "
108- echo "> \`npm install -g npx\`\n\n "
108+ [ tasks . check-awk ]
109+ description = " Check awk is installed "
110+ script = '''
111+ if ! which awk >/dev/null; then
112+ echo "❌ awk could not be found "
113+ echo " Consider installing awk (usually pre-installed on Unix systems) "
109114 exit 1
110115fi
111- echo "✅ \`npx\` installed"
116+ '''
112117
113- echo "❔ Checking \`awk\` installed..."
114- if ! which awk >/dev/null;
115- then
116- echo "\n❌ awk could not be found"
117- echo " Consider installing awk."
118+ [tasks .check-perl ]
119+ description = " Check perl is installed"
120+ script = '''
121+ if ! which perl >/dev/null; then
122+ echo "❌ perl could not be found"
123+ echo " Consider installing perl (usually pre-installed on Unix systems)"
118124 exit 1
119125fi
120- echo "✅ \`perl\` installed"
126+ '''
121127
122- echo "❔ Checking \`perl\` installed..."
123- if ! which perl >/dev/null;
124- then
125- echo "\n❌ perl could not be found"
126- echo " Consider installing perl."
128+ [tasks .check-jq ]
129+ description = " Check jq is installed (version 1.7 or higher, but below 2.0)"
130+ script = '''
131+ if ! which jq >/dev/null; then
132+ echo "❌ jq could not be found"
133+ echo " Consider installing jq: brew install jq (macOS) or apt-get install jq (Linux)"
127134 exit 1
128135fi
129- echo "✅ \`perl\` installed"
130136
131- echo "❔ Checking \`jq\` installation..."
132- if [[ $(jq --version) != jq-1\.7* ]]
133- then
134- echo "\n❌ Require jq version 1.7"
137+ jq_version=$(jq --version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1)
138+ jq_major=$(echo "$jq_version" | cut -d. -f1)
139+ jq_minor=$(echo "$jq_version" | cut -d. -f2)
140+
141+ if [ "$jq_major" -lt 1 ] || ([ "$jq_major" -eq 1 ] && [ "$jq_minor" -lt 7 ]); then
142+ echo "❌ jq version $jq_version is too old (require >= 1.7)"
135143 exit 1
136144fi
137- echo "✅ \`jq\` installed"
145+
146+ if [ "$jq_major" -ge 2 ]; then
147+ echo "⚠️ Warning: jq version $jq_version is untested (expected 1.7-1.x)"
148+ fi
149+ '''
150+
151+ [tasks .check-prerequisites ]
152+ dependencies = [" check-npx" , " check-awk" , " check-perl" , " check-jq" ]
153+ description = " Check all the prerequisites are installed"
154+ script = '''
155+ echo "✅ All prerequisites are satisfied"
138156'''
139157
140158[tasks .docs-generate ]
0 commit comments