prometheus/scripts/check-node-version.sh
Ayoub Mrini 0f0cd5c2cf
chore: add Makefile target to check Node.js version (#16832)
This helps reduce confusion when UI-related targets fail without
directly indicating a version mismatch.

Automatically runs during UI builds and tests. The check is only
indicative.

The "go" binary can hard stop and print relevant messages on its
own for mismatches, thus not covered here.

supersedes https://github.com/prometheus/prometheus/pull/15106

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
Co-authored-by: Pratham <prathamjagga123@gmail.com>
2025-07-15 12:52:43 +02:00

12 lines
420 B
Bash
Executable File

#!/usr/bin/env bash
YELLOW='\033[0;33m'
NC='\033[0m'
MIN_NODE_VERSION=$(cat web/ui/.nvmrc | sed 's/v//')
CURRENT_NODE_VERSION=$(node --version | sed 's/v//')
if [ "$(echo -e "$CURRENT_NODE_VERSION\n$MIN_NODE_VERSION" | sort -V | head -n 1)" != "$MIN_NODE_VERSION" ]; then
printf "${YELLOW}Warning:${NC}: Node.js version mismatch! Required minimum: $MIN_NODE_VERSION Installed version: $CURRENT_NODE_VERSION\n"
fi