mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-05 13:47:10 +02:00
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>
This commit is contained in:
parent
0fc5e75504
commit
0f0cd5c2cf
8
Makefile
8
Makefile
@ -81,7 +81,7 @@ ui-lint:
|
|||||||
|
|
||||||
.PHONY: assets
|
.PHONY: assets
|
||||||
ifndef SKIP_UI_BUILD
|
ifndef SKIP_UI_BUILD
|
||||||
assets: ui-install ui-build
|
assets: check-node-version ui-install ui-build
|
||||||
|
|
||||||
.PHONY: npm_licenses
|
.PHONY: npm_licenses
|
||||||
npm_licenses: ui-install
|
npm_licenses: ui-install
|
||||||
@ -143,7 +143,7 @@ install-goyacc:
|
|||||||
ifeq ($(GO_ONLY),1)
|
ifeq ($(GO_ONLY),1)
|
||||||
test: common-test check-go-mod-version
|
test: common-test check-go-mod-version
|
||||||
else
|
else
|
||||||
test: check-generated-parser common-test ui-build-module ui-test ui-lint check-go-mod-version
|
test: check-generated-parser common-test check-node-version ui-build-module ui-test ui-lint check-go-mod-version
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: tarball
|
.PHONY: tarball
|
||||||
@ -192,3 +192,7 @@ update-all-go-deps:
|
|||||||
$(GO) get $$m; \
|
$(GO) get $$m; \
|
||||||
done
|
done
|
||||||
@cd ./documentation/examples/remote_storage/ && $(GO) mod tidy
|
@cd ./documentation/examples/remote_storage/ && $(GO) mod tidy
|
||||||
|
|
||||||
|
.PHONY: check-node-version
|
||||||
|
check-node-version:
|
||||||
|
@./scripts/check-node-version.sh
|
||||||
|
11
scripts/check-node-version.sh
Executable file
11
scripts/check-node-version.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/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
|
Loading…
Reference in New Issue
Block a user