mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-06 09:30:29 +00:00
feat(release): add cross-platform packaging
Add target-aware engine provisioning, platform package configs, and CI/release verification for macOS arm64, Windows x64, and Linux AppImage.
This commit is contained in:
@@ -9,6 +9,7 @@ vi.mock('@tauri-apps/api/path', () => ({
|
||||
}));
|
||||
|
||||
import {
|
||||
downloadLocationEquals,
|
||||
DEFAULT_CATEGORY_SUBFOLDERS,
|
||||
normalizeCategorySubfolder,
|
||||
normalizeDownloadLocationSettings,
|
||||
@@ -16,6 +17,11 @@ import {
|
||||
} from './downloadLocations';
|
||||
|
||||
describe('download locations', () => {
|
||||
it('compares Windows and macOS locations case-insensitively', () => {
|
||||
expect(downloadLocationEquals('D:\\Downloads', 'Movie.MP4', 'd:/downloads', 'movie.mp4', 'windows')).toBe(true);
|
||||
expect(downloadLocationEquals('/Users/Test', 'Movie.MP4', '/users/test', 'movie.mp4', 'macos')).toBe(true);
|
||||
expect(downloadLocationEquals('/home/Test', 'Movie.MP4', '/home/test', 'movie.mp4', 'linux')).toBe(false);
|
||||
});
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
@@ -143,3 +143,20 @@ export const resolveDownloadFilePath = async (
|
||||
const expandedDest = await expandTilde(destination);
|
||||
return join(expandedDest, fileName);
|
||||
};
|
||||
|
||||
export const downloadLocationEquals = (
|
||||
leftDirectory: string,
|
||||
leftFileName: string,
|
||||
rightDirectory: string,
|
||||
rightFileName: string,
|
||||
os: string
|
||||
): boolean => {
|
||||
const normalize = (value: string) => {
|
||||
const normalized = value.replace(/\\/g, '/').replace(/\/+$/, '');
|
||||
return os === 'windows' || os === 'macos'
|
||||
? normalized.toLocaleLowerCase()
|
||||
: normalized;
|
||||
};
|
||||
return normalize(`${leftDirectory}/${leftFileName}`)
|
||||
=== normalize(`${rightDirectory}/${rightFileName}`);
|
||||
};
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { info as tauriInfo, warn as tauriWarn, error as tauriError, debug as tau
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
|
||||
// Default to true to match backend default
|
||||
let isPaused = true;
|
||||
let isPaused = false;
|
||||
|
||||
let initPromise: Promise<void> | null = null;
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import type { PlatformInfo } from '../bindings/PlatformInfo';
|
||||
import { invokeCommand as invoke } from '../ipc';
|
||||
|
||||
const fallback: PlatformInfo = {
|
||||
os: 'unknown',
|
||||
arch: 'unknown',
|
||||
targetTriple: 'unknown'
|
||||
};
|
||||
|
||||
let cached: PlatformInfo | null = null;
|
||||
let pending: Promise<PlatformInfo> | null = null;
|
||||
|
||||
export const getPlatformInfo = (): Promise<PlatformInfo> => {
|
||||
if (cached) return Promise.resolve(cached);
|
||||
if (!pending) {
|
||||
pending = invoke('get_platform_info')
|
||||
.then(info => {
|
||||
cached = info;
|
||||
return info;
|
||||
})
|
||||
.finally(() => {
|
||||
pending = null;
|
||||
});
|
||||
}
|
||||
return pending;
|
||||
};
|
||||
|
||||
export const usePlatformInfo = () => {
|
||||
const [platform, setPlatform] = useState<PlatformInfo>(cached ?? fallback);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
void getPlatformInfo()
|
||||
.then(info => {
|
||||
if (active) setPlatform(info);
|
||||
})
|
||||
.catch(() => undefined);
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
return platform;
|
||||
};
|
||||
Reference in New Issue
Block a user