mirror of
https://github.com/acedanger/finance.git
synced 2025-12-05 22:50:12 -08:00
feat: add Reset-Environment.ps1 script for resetting finance development environment
This commit is contained in:
@@ -9,7 +9,7 @@ set -o pipefail # Error if any command in a pipe fails
|
||||
# Constants
|
||||
readonly SCRIPT_NAME="$(basename "$0")"
|
||||
readonly WORK_DIR="/home/acedanger/dev/finance"
|
||||
readonly REQUIRED_NODE_VERSION="20.19.0" # Match the version from devcontainer
|
||||
readonly REQUIRED_NODE_VERSION="20.19.0" # Minimum required version
|
||||
|
||||
# Functions
|
||||
log() {
|
||||
@@ -23,10 +23,15 @@ error() {
|
||||
validate_node_version() {
|
||||
local current_version
|
||||
current_version=$(node -v | cut -d 'v' -f 2)
|
||||
if [[ "$current_version" != "$REQUIRED_NODE_VERSION" ]]; then
|
||||
error "Node.js version mismatch. Required: $REQUIRED_NODE_VERSION, Found: $current_version"
|
||||
|
||||
# Use sort -V for version comparison
|
||||
if [[ "$(printf '%s\n' "$REQUIRED_NODE_VERSION" "$current_version" | sort -V | head -n1)" != "$REQUIRED_NODE_VERSION" ]]; then
|
||||
# If the first entry is not the required version, it means current < required
|
||||
error "Node.js version too old. Minimum required: $REQUIRED_NODE_VERSION, Found: $current_version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Node.js version check passed. Required: $REQUIRED_NODE_VERSION+, Found: $current_version"
|
||||
}
|
||||
|
||||
validate_dependencies() {
|
||||
|
||||
Reference in New Issue
Block a user