🐛 Fixed icon download and command display
This commit is contained in:
6
bin/cli.ts
vendored
6
bin/cli.ts
vendored
@@ -50,8 +50,8 @@ program
|
||||
.option('--hide-title-bar', 'For Mac, hide title bar', DEFAULT.hideTitleBar)
|
||||
.option('--multi-arch', 'For Mac, both Intel and M1', DEFAULT.multiArch)
|
||||
.option(
|
||||
'--inject <./style.css,./script.js,...>',
|
||||
'Injection of .js or .css files',
|
||||
'--inject <files>',
|
||||
'Inject local CSS/JS files into the page',
|
||||
(val, previous) => {
|
||||
if (!val) return DEFAULT.inject;
|
||||
|
||||
@@ -83,7 +83,7 @@ program
|
||||
.addOption(
|
||||
new Option(
|
||||
'--targets <string>',
|
||||
'Build target: Linux: "deb", "rpm", "appimage", "deb-arm64", "rpm-arm64", "appimage-arm64"; Windows: "x64", "arm64"; macOS: "intel", "apple", "universal"',
|
||||
'Build target format for your system',
|
||||
).default(DEFAULT.targets),
|
||||
)
|
||||
.addOption(
|
||||
|
||||
13
bin/options/icon.ts
vendored
13
bin/options/icon.ts
vendored
@@ -17,7 +17,7 @@ import { PakeAppOptions } from '@/types';
|
||||
const ICON_CONFIG = {
|
||||
minFileSize: 100,
|
||||
downloadTimeout: 10000,
|
||||
supportedFormats: ['png', 'ico', 'jpeg', 'jpg', 'webp'] as const,
|
||||
supportedFormats: ['png', 'ico', 'jpeg', 'jpg', 'webp', 'icns'] as const,
|
||||
whiteBackground: { r: 255, g: 255, b: 255 },
|
||||
};
|
||||
|
||||
@@ -109,6 +109,17 @@ export async function handleIcon(options: PakeAppOptions, url?: string) {
|
||||
if (options.icon.startsWith('http')) {
|
||||
const downloadedPath = await downloadIcon(options.icon);
|
||||
if (downloadedPath && options.name) {
|
||||
// Check if the downloaded file is already in the correct format for the platform
|
||||
const downloadedExt = path.extname(downloadedPath).toLowerCase();
|
||||
const isCorrectFormat =
|
||||
(IS_WIN && downloadedExt === '.ico') ||
|
||||
(IS_LINUX && downloadedExt === '.png') ||
|
||||
(!IS_WIN && !IS_LINUX && downloadedExt === '.icns'); // macOS
|
||||
|
||||
if (isCorrectFormat) {
|
||||
return downloadedPath;
|
||||
}
|
||||
|
||||
// Convert downloaded icon to platform-specific format
|
||||
const convertedPath = await convertIconFormat(
|
||||
downloadedPath,
|
||||
|
||||
Reference in New Issue
Block a user