#!/usr/bin/env node
// Cross-platform test script to demonstrate artifact naming for different versions

const fs = require('fs');
const path = require('path');

console.log('=== Artifact Naming Test (Cross-Platform) ===');
console.log('');

// Get current version
const packageJsonPath = path.join(__dirname, '..', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const currentVersion = packageJson.version;

console.log(`Current version: ${currentVersion}`);

// Function to get artifact suffix
function getArtifactSuffix(version) {
    if (version.includes('alpha')) {
        return `alpha-${version}-`;
    } else if (version.includes('beta')) {
        return `beta-${version}-`;
    } else {
        return '';
    }
}

// Test scenarios
const testVersions = [
    '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
];

console.log('Test scenarios:');
console.log('==================');

testVersions.forEach(version => {
    const suffix = getArtifactSuffix(version);
    
    // Different artifact names for different platforms
    const windowsArtifact = `imex-partner-${suffix}x64.exe`;
    const macArtifact = `imex-partner-${suffix}x64.dmg`;
    const linuxArtifact = `imex-partner-${suffix}x64.AppImage`;
    
    console.log(`Version: ${version}`);
    console.log(`  Suffix: '${suffix}'`);
    console.log(`  Windows: ${windowsArtifact}`);
    console.log(`  Mac: ${macArtifact}`);
    console.log(`  Linux: ${linuxArtifact}`);
    console.log('');
});

console.log('Current configuration will produce:');
const currentSuffix = getArtifactSuffix(currentVersion);
console.log(`  Windows: imex-partner-${currentSuffix}x64.exe`);
console.log(`  Mac: imex-partner-${currentSuffix}x64.dmg`);
console.log(`  Linux: imex-partner-${currentSuffix}x64.AppImage`);

console.log('');
console.log(`Platform detected: ${process.platform}`);
console.log(`Architecture: ${process.arch}`);
