19 lines
693 B
Bash
19 lines
693 B
Bash
#!/usr/bin/env bash
|
|
# Sourced by the wrapper and hook; select Node without changing the caller's shell.
|
|
testtask_node_ready() {
|
|
command -v node >/dev/null 2>&1 &&
|
|
node -e 'const [a,b]=process.versions.node.split(".").map(Number); process.exit(a>20 || (a===20 && b>=19) ? 0 : 1)' >/dev/null 2>&1
|
|
}
|
|
if ! testtask_node_ready; then
|
|
TESTTASK_NVM_SCRIPT="${NVM_DIR:-$HOME/.nvm}/nvm.sh"
|
|
if [[ -f "$TESTTASK_NVM_SCRIPT" ]]; then
|
|
source "$TESTTASK_NVM_SCRIPT"
|
|
nvm use 24 >/dev/null 2>&1 || true
|
|
fi
|
|
fi
|
|
if ! testtask_node_ready; then
|
|
echo 'testtask: Node >=20.19 is required; install Node 24 through nvm or put a supported Node on PATH.' >&2
|
|
return 1
|
|
fi
|
|
unset TESTTASK_NVM_SCRIPT
|