#!/bin/bash
# Test script to demonstrate artifact naming for different versions on Mac

echo "=== Artifact Naming Test (Mac) ==="
echo ""

# Get current version
PACKAGE_JSON_PATH="./package.json"
CURRENT_VERSION=$(node -p "require('$PACKAGE_JSON_PATH').version")

echo "Current version: $CURRENT_VERSION"

# Function to get artifact suffix
get_artifact_suffix() {
    local version=$1
    if [[ $version == *"alpha"* ]]; then
        echo "alpha-${version}-"
    elif [[ $version == *"beta"* ]]; then
        echo "beta-${version}-"
    else
        echo ""
    fi
}

# Test scenarios
TEST_VERSIONS=(
    "1.0.5"               # Release version
    "1.0.5-alpha.2"       # Alpha version
    "1.0.5-beta.1"        # Beta version
    "2.0.0-alpha.1"       # Another alpha
    "1.5.0-beta.3"        # Another beta
)

echo "Test scenarios:"
echo "=================="

for version in "${TEST_VERSIONS[@]}"; do
    suffix=$(get_artifact_suffix "$version")
    artifact_name="imex-partner-${suffix}x64.dmg"
    
    echo "Version: $version"
    echo "  Suffix: '$suffix'"
    echo "  Result: $artifact_name"
    echo ""
done

echo "Current configuration will produce:"
current_suffix=$(get_artifact_suffix "$CURRENT_VERSION")
current_artifact="imex-partner-${current_suffix}x64.dmg"
echo "  $current_artifact"
