Update executable names for beta and alpha paths.
This commit is contained in:
53
deploy/set-artifact-name.js
Normal file
53
deploy/set-artifact-name.js
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env node
|
||||
// Cross-platform script to set artifact naming based on version
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
// Read the package.json to get the version
|
||||
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
const version = packageJson.version;
|
||||
|
||||
console.log(`Current version: ${version}`);
|
||||
|
||||
// Determine the artifact suffix based on the version
|
||||
let artifactSuffix = '';
|
||||
|
||||
if (version.includes('alpha')) {
|
||||
artifactSuffix = `alpha-${version}-`;
|
||||
console.log(`Detected alpha version, setting suffix to: ${artifactSuffix}`);
|
||||
} else if (version.includes('beta')) {
|
||||
artifactSuffix = `beta-${version}-`;
|
||||
console.log(`Detected beta version, setting suffix to: ${artifactSuffix}`);
|
||||
} else {
|
||||
artifactSuffix = '';
|
||||
console.log('Detected release version, no suffix will be added');
|
||||
}
|
||||
|
||||
// Set the environment variable for the current process
|
||||
process.env.ARTIFACT_SUFFIX = artifactSuffix;
|
||||
|
||||
console.log(`ARTIFACT_SUFFIX set to: '${artifactSuffix}'`);
|
||||
|
||||
// If arguments are passed, execute the remaining command with the environment variable set
|
||||
if (process.argv.length > 2) {
|
||||
const command = process.argv[2];
|
||||
const args = process.argv.slice(3);
|
||||
|
||||
console.log(`Executing: ${command} ${args.join(' ')}`);
|
||||
|
||||
const child = spawn(command, args, {
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env, ARTIFACT_SUFFIX: artifactSuffix },
|
||||
shell: true
|
||||
});
|
||||
|
||||
child.on('close', (code) => {
|
||||
process.exit(code);
|
||||
});
|
||||
} else {
|
||||
// Just setting the environment variable
|
||||
console.log('Environment variable set. Use this script with additional arguments to run commands with the variable set.');
|
||||
}
|
||||
38
deploy/set-artifact-name.ps1
Normal file
38
deploy/set-artifact-name.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
# PowerShell script to set artifact naming based on version
|
||||
param(
|
||||
[string]$ConfigType = "imex"
|
||||
)
|
||||
|
||||
# Read the package.json to get the version
|
||||
$packageJsonPath = Join-Path $PSScriptRoot "..\package.json"
|
||||
$packageJson = Get-Content $packageJsonPath | ConvertFrom-Json
|
||||
$version = $packageJson.version
|
||||
|
||||
Write-Host "Current version: $version"
|
||||
|
||||
# Determine the artifact suffix based on the version
|
||||
$artifactSuffix = ""
|
||||
|
||||
if ($version -match "alpha") {
|
||||
$artifactSuffix = "alpha-${version}-"
|
||||
Write-Host "Detected alpha version, setting suffix to: $artifactSuffix"
|
||||
}
|
||||
elseif ($version -match "beta") {
|
||||
$artifactSuffix = "beta-${version}-"
|
||||
Write-Host "Detected beta version, setting suffix to: $artifactSuffix"
|
||||
}
|
||||
else {
|
||||
$artifactSuffix = ""
|
||||
Write-Host "Detected release version, no suffix will be added"
|
||||
}
|
||||
|
||||
# Set the environment variable
|
||||
$env:ARTIFACT_SUFFIX = $artifactSuffix
|
||||
|
||||
# Export for the current session
|
||||
[Environment]::SetEnvironmentVariable("ARTIFACT_SUFFIX", $artifactSuffix, "Process")
|
||||
|
||||
Write-Host "ARTIFACT_SUFFIX set to: '$env:ARTIFACT_SUFFIX'"
|
||||
|
||||
# Return the suffix for use in other scripts
|
||||
return $artifactSuffix
|
||||
33
deploy/set-artifact-name.sh
Normal file
33
deploy/set-artifact-name.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Bash script to set artifact naming based on version
|
||||
|
||||
# Get the directory where this script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Read the package.json to get the version
|
||||
PACKAGE_JSON_PATH="$SCRIPT_DIR/../package.json"
|
||||
VERSION=$(node -p "require('$PACKAGE_JSON_PATH').version")
|
||||
|
||||
echo "Current version: $VERSION"
|
||||
|
||||
# Determine the artifact suffix based on the version
|
||||
ARTIFACT_SUFFIX=""
|
||||
|
||||
if [[ $VERSION == *"alpha"* ]]; then
|
||||
ARTIFACT_SUFFIX="alpha-${VERSION}-"
|
||||
echo "Detected alpha version, setting suffix to: $ARTIFACT_SUFFIX"
|
||||
elif [[ $VERSION == *"beta"* ]]; then
|
||||
ARTIFACT_SUFFIX="beta-${VERSION}-"
|
||||
echo "Detected beta version, setting suffix to: $ARTIFACT_SUFFIX"
|
||||
else
|
||||
ARTIFACT_SUFFIX=""
|
||||
echo "Detected release version, no suffix will be added"
|
||||
fi
|
||||
|
||||
# Export the environment variable
|
||||
export ARTIFACT_SUFFIX="$ARTIFACT_SUFFIX"
|
||||
|
||||
echo "ARTIFACT_SUFFIX set to: '$ARTIFACT_SUFFIX'"
|
||||
|
||||
# Also write to a temporary file for sourcing in other scripts
|
||||
echo "export ARTIFACT_SUFFIX='$ARTIFACT_SUFFIX'" > "$SCRIPT_DIR/.artifact-suffix.env"
|
||||
64
deploy/test-artifact-naming-cross-platform.js
Normal file
64
deploy/test-artifact-naming-cross-platform.js
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/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}`);
|
||||
48
deploy/test-artifact-naming.ps1
Normal file
48
deploy/test-artifact-naming.ps1
Normal file
@@ -0,0 +1,48 @@
|
||||
# Test script to demonstrate artifact naming for different versions
|
||||
Write-Host "=== Artifact Naming Test ==="
|
||||
Write-Host ""
|
||||
|
||||
# Test current version
|
||||
$packageJsonPath = ".\package.json"
|
||||
$packageJson = Get-Content $packageJsonPath | ConvertFrom-Json
|
||||
$currentVersion = $packageJson.version
|
||||
|
||||
Write-Host "Current version: $currentVersion"
|
||||
|
||||
# Function to get artifact suffix
|
||||
function Get-ArtifactSuffix($version) {
|
||||
if ($version -match "alpha") {
|
||||
return "alpha-${version}-"
|
||||
} elseif ($version -match "beta") {
|
||||
return "beta-${version}-"
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
# Test scenarios
|
||||
$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
|
||||
)
|
||||
|
||||
Write-Host "Test scenarios:"
|
||||
Write-Host "=================="
|
||||
|
||||
foreach ($version in $testVersions) {
|
||||
$suffix = Get-ArtifactSuffix $version
|
||||
$artifactName = "imex-partner-${suffix}x64.exe"
|
||||
|
||||
Write-Host "Version: $version"
|
||||
Write-Host " Suffix: '$suffix'"
|
||||
Write-Host " Result: $artifactName"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Current configuration will produce:"
|
||||
$currentSuffix = Get-ArtifactSuffix $currentVersion
|
||||
$currentArtifact = "imex-partner-${currentSuffix}x64.exe"
|
||||
Write-Host " $currentArtifact"
|
||||
50
deploy/test-artifact-naming.sh
Normal file
50
deploy/test-artifact-naming.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/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"
|
||||
@@ -23,7 +23,7 @@ win:
|
||||
certificateProfileName: ImEXRPS
|
||||
codeSigningAccountName: ImEX
|
||||
nsis:
|
||||
artifactName: imex-partner-${arch}.${ext}
|
||||
artifactName: imex-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
@@ -49,7 +49,7 @@ mac:
|
||||
arch:
|
||||
- x64
|
||||
dmg:
|
||||
artifactName: imex-partner-${arch}.${ext}
|
||||
artifactName: imex-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
@@ -59,7 +59,7 @@ linux:
|
||||
category: Utility
|
||||
desktop: scripts/imex-shop-partner.desktop
|
||||
appImage:
|
||||
artifactName: imex-partner-${arch}.${ext}
|
||||
artifactName: imex-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
|
||||
npmRebuild: false
|
||||
publish:
|
||||
provider: s3
|
||||
|
||||
@@ -23,7 +23,7 @@ win:
|
||||
certificateProfileName: ImEXRPS
|
||||
codeSigningAccountName: ImEX
|
||||
nsis:
|
||||
artifactName: rome-partner-${arch}.${ext}
|
||||
artifactName: rome-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: always
|
||||
@@ -50,7 +50,7 @@ mac:
|
||||
arch:
|
||||
- x64
|
||||
dmg:
|
||||
artifactName: rome-partner-${arch}.${ext}
|
||||
artifactName: rome-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
@@ -60,7 +60,7 @@ linux:
|
||||
category: Utility
|
||||
desktop: scripts/rome-shop-partner.desktop
|
||||
appImage:
|
||||
artifactName: rome-partner-${arch}.${ext}
|
||||
artifactName: rome-partner-${env.ARTIFACT_SUFFIX}${arch}.${ext}
|
||||
npmRebuild: false
|
||||
publish:
|
||||
provider: s3
|
||||
|
||||
30
package-lock.json
generated
30
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "bodyshop-desktop",
|
||||
"version": "0.0.1-alpha.11",
|
||||
"version": "1.0.5-alpha.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "bodyshop-desktop",
|
||||
"version": "0.0.1-alpha.11",
|
||||
"version": "1.0.5-alpha.2",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.13.6",
|
||||
@@ -41,6 +41,7 @@
|
||||
"archiver": "^7.0.1",
|
||||
"chokidar": "^4.0.3",
|
||||
"cors": "^2.8.5",
|
||||
"cross-env": "^10.0.0",
|
||||
"dbffile": "^1.12.0",
|
||||
"electron": "^35.1.5",
|
||||
"electron-builder": "^25.1.8",
|
||||
@@ -1002,6 +1003,13 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@epic-web/invariant": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz",
|
||||
"integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.25.2",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.2.tgz",
|
||||
@@ -6936,6 +6944,24 @@
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-env": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.0.0.tgz",
|
||||
"integrity": "sha512-aU8qlEK/nHYtVuN4p7UQgAwVljzMg8hB4YK5ThRqD2l/ziSnryncPNn7bMLt5cFYsKVKBh8HqLqyCoTupEUu7Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@epic-web/invariant": "^1.0.0",
|
||||
"cross-spawn": "^7.0.6"
|
||||
},
|
||||
"bin": {
|
||||
"cross-env": "dist/bin/cross-env.js",
|
||||
"cross-env-shell": "dist/bin/cross-env-shell.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
|
||||
23
package.json
23
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bodyshop-desktop",
|
||||
"version": "1.0.5-alpha.1",
|
||||
"version": "1.0.5-alpha.2",
|
||||
"description": "Shop Management System Partner",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "Convenient Brands, LLC",
|
||||
@@ -13,17 +13,17 @@
|
||||
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
||||
"start": "electron-vite preview",
|
||||
"dev": "electron-vite dev",
|
||||
"build:imex": "electron-vite build --mode imex && electron-builder --config electron-builder.imex.yml",
|
||||
"build:rome": "electron-vite build --mode rome && electron-builder --config electron-builder.rome.yml",
|
||||
"build:imex:publish": "electron-vite build --mode imex && electron-builder --config electron-builder.imex.yml --publish always",
|
||||
"build:rome:publish": "electron-vite build --mode rome && electron-builder --config electron-builder.rome.yml --publish always",
|
||||
"build:imex:linux": "electron-vite build --mode imex && electron-builder --config electron-builder.imex.yml --linux",
|
||||
"build:rome:linux": "electron-vite build --mode rome && electron-builder --config electron-builder.rome.yml --linux",
|
||||
"build:imex": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --config electron-builder.imex.yml",
|
||||
"build:rome": "node deploy/set-artifact-name.js electron-vite build --mode rome && node deploy/set-artifact-name.js electron-builder --config electron-builder.rome.yml",
|
||||
"build:imex:publish": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --config electron-builder.imex.yml --publish always",
|
||||
"build:rome:publish": "node deploy/set-artifact-name.js electron-vite build --mode rome && node deploy/set-artifact-name.js electron-builder --config electron-builder.rome.yml --publish always",
|
||||
"build:imex:linux": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --config electron-builder.imex.yml --linux",
|
||||
"build:rome:linux": "node deploy/set-artifact-name.js electron-vite build --mode rome && node deploy/set-artifact-name.js electron-builder --config electron-builder.rome.yml --linux",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"build:unpack": "electron-vite build --mode imex && electron-builder --dir",
|
||||
"build:win": "electron-vite build --mode imex && electron-builder --win",
|
||||
"build:mac": "electron-vite build --mode imex && electron-builder --mac",
|
||||
"build:linux": "electron-vite build --mode imex && electron-builder --linux"
|
||||
"build:unpack": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --dir",
|
||||
"build:win": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --win",
|
||||
"build:mac": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --mac",
|
||||
"build:linux": "node deploy/set-artifact-name.js electron-vite build --mode imex && node deploy/set-artifact-name.js electron-builder --linux"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.13.6",
|
||||
@@ -58,6 +58,7 @@
|
||||
"archiver": "^7.0.1",
|
||||
"chokidar": "^4.0.3",
|
||||
"cors": "^2.8.5",
|
||||
"cross-env": "^10.0.0",
|
||||
"dbffile": "^1.12.0",
|
||||
"electron": "^35.1.5",
|
||||
"electron-builder": "^25.1.8",
|
||||
|
||||
@@ -531,7 +531,7 @@ app.whenReady().then(async () => {
|
||||
|
||||
//Check for app updates.
|
||||
autoUpdater.logger = log;
|
||||
|
||||
autoUpdater.allowDowngrade = true;
|
||||
// if (import.meta.env.DEV) {
|
||||
// // Useful for some dev/debugging tasks, but download can
|
||||
// // not be validated because dev app is not signed
|
||||
|
||||
Reference in New Issue
Block a user