feat: add Reset-Environment.ps1 script for resetting finance development environment

This commit is contained in:
Peter Wood
2025-05-17 10:46:51 -04:00
parent 587fb7f3f8
commit ebd9148cb5
2 changed files with 157 additions and 3 deletions

View File

@@ -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() {