윈도우 앱 재설치 없이 업데이트
This commit is contained in:
@@ -48,6 +48,15 @@ function cmpSemver(a, b) {
|
||||
/** @type {Record<string, { url: string; signature: string; bundleVersion: string }>} */
|
||||
const platforms = {};
|
||||
|
||||
/** Windows updater bundle 우선순위 (낮을수록 preferred) — setup.exe 수동 설치용은 제외 */
|
||||
function windowsBundlePriority(name) {
|
||||
const lower = name.toLowerCase();
|
||||
if (lower.endsWith('.nsis.zip')) return 0;
|
||||
if (lower.endsWith('.msi.zip')) return 1;
|
||||
if (lower.endsWith('-setup.exe') || (lower.includes('setup') && lower.endsWith('.exe'))) return 9;
|
||||
return 5;
|
||||
}
|
||||
|
||||
function addPlatform(platformKey, bundleName) {
|
||||
const bundlePath = path.join(dir, bundleName);
|
||||
if (!fs.existsSync(bundlePath)) return;
|
||||
@@ -62,7 +71,17 @@ function addPlatform(platformKey, bundleName) {
|
||||
const bundleVersion = versionFromName(bundleName);
|
||||
const effectiveVersion = bundleVersion === '0.0.0' ? version : bundleVersion;
|
||||
const existing = platforms[platformKey];
|
||||
if (existing && cmpSemver(effectiveVersion, existing.bundleVersion) <= 0) return;
|
||||
if (existing) {
|
||||
const cmp = cmpSemver(effectiveVersion, existing.bundleVersion);
|
||||
if (cmp < 0) return;
|
||||
if (cmp === 0 && platformKey === 'windows-x86_64') {
|
||||
const prevPri = windowsBundlePriority(path.basename(existing.url.split('/').pop() ?? ''));
|
||||
const nextPri = windowsBundlePriority(bundleName);
|
||||
if (nextPri > prevPri) return;
|
||||
} else if (cmp === 0 && platformKey !== 'windows-x86_64') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
platforms[platformKey] = {
|
||||
url: `${baseUrl}/${encodeURIComponent(bundleName)}`,
|
||||
signature,
|
||||
|
||||
Reference in New Issue
Block a user