Auto-fix formatting issues

This commit is contained in:
GitHub Action
2025-09-16 11:14:56 +00:00
parent b6be411c7a
commit 2925b2f56b
5 changed files with 39 additions and 31 deletions

View File

@@ -47,6 +47,7 @@ pnpm run dev # Development with hot reload
```
**Testing:**
- Always run `pnpm test` before committing
- For CLI testing: `node dist/cli.js https://example.com --name TestApp --debug`
- For app functionality testing: Use `pnpm run dev` for hot reload

View File

@@ -233,7 +233,8 @@ StartupNotify=true
};
const iconInfo = platformIconMap[platform];
const resolvedIconPath = options.icon ? path.resolve(options.icon) : null;
const exists = resolvedIconPath && (await fsExtra.pathExists(resolvedIconPath));
const exists =
resolvedIconPath && (await fsExtra.pathExists(resolvedIconPath));
if (exists) {
let updateIconPath = true;
let customIconExt = path.extname(resolvedIconPath).toLowerCase();

4
bin/options/icon.ts vendored
View File

@@ -46,7 +46,9 @@ const API_KEYS = {
import { generateSafeFilename } from '@/utils/name';
function generateIconPath(appName: string, isDefault = false): string {
const safeName = isDefault ? 'icon' : generateSafeFilename(appName).toLowerCase();
const safeName = isDefault
? 'icon'
: generateSafeFilename(appName).toLowerCase();
const baseName = safeName;
if (IS_WIN) {

10
bin/utils/name.ts vendored
View File

@@ -15,9 +15,7 @@ export function generateLinuxPackageName(name: string): string {
}
export function generateIdentifierSafeName(name: string): string {
return name
.replace(/[^a-zA-Z0-9]/g, '')
.toLowerCase();
return name.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
}
export function generateWindowsFilename(name: string): string {
@@ -28,7 +26,5 @@ export function generateWindowsFilename(name: string): string {
}
export function generateMacOSFilename(name: string): string {
return name
.replace(/[:]/g, '_')
.slice(0, 255);
}
return name.replace(/[:]/g, '_').slice(0, 255);
}

View File

@@ -273,29 +273,31 @@ document.addEventListener("DOMContentLoaded", () => {
binary: Array.from(binary),
language: userLanguage,
},
}).catch(error => {
console.error('Failed to download data URI file:', filename, error);
}).catch((error) => {
console.error("Failed to download data URI file:", filename, error);
});
} catch (error) {
console.error('Failed to process data URI:', dataURI, error);
console.error("Failed to process data URI:", dataURI, error);
}
}
function downloadFromBlobUrl(blobUrl, filename) {
convertBlobUrlToBinary(blobUrl).then((binary) => {
const userLanguage = navigator.language || navigator.userLanguage;
invoke("download_file_by_binary", {
params: {
filename,
binary,
language: userLanguage,
},
}).catch(error => {
console.error('Failed to download blob file:', filename, error);
convertBlobUrlToBinary(blobUrl)
.then((binary) => {
const userLanguage = navigator.language || navigator.userLanguage;
invoke("download_file_by_binary", {
params: {
filename,
binary,
language: userLanguage,
},
}).catch((error) => {
console.error("Failed to download blob file:", filename, error);
});
})
.catch((error) => {
console.error("Failed to convert blob to binary:", blobUrl, error);
});
}).catch(error => {
console.error('Failed to convert blob to binary:', blobUrl, error);
});
}
// detect blob download by createElement("a")
@@ -335,14 +337,14 @@ document.addEventListener("DOMContentLoaded", () => {
const handleExternalLink = (url) => {
// Don't try to open blob: or data: URLs with shell
if (isSpecialDownload(url)) {
console.warn('Cannot open special URL with shell:', url);
console.warn("Cannot open special URL with shell:", url);
return;
}
invoke("plugin:shell|open", {
path: url,
}).catch(error => {
console.error('Failed to open URL with shell:', url, error);
}).catch((error) => {
console.error("Failed to open URL with shell:", url, error);
});
};
@@ -370,7 +372,7 @@ document.addEventListener("DOMContentLoaded", () => {
const detectAnchorElementClick = (e) => {
// Safety check: ensure e.target exists and is an Element with closest method
if (!e.target || typeof e.target.closest !== 'function') {
if (!e.target || typeof e.target.closest !== "function") {
return;
}
const anchorElement = e.target.closest("a");
@@ -723,7 +725,10 @@ document.addEventListener("DOMContentLoaded", () => {
}
// Check for parent elements with background images
const parentWithBg = target && typeof target.closest === 'function' ? target.closest('[style*="background-image"]') : null;
const parentWithBg =
target && typeof target.closest === "function"
? target.closest('[style*="background-image"]')
: null;
if (parentWithBg) {
const bgImage = parentWithBg.style.backgroundImage;
const urlMatch = bgImage.match(/url\(["']?([^"')]+)["']?\)/);
@@ -792,7 +797,10 @@ document.addEventListener("DOMContentLoaded", () => {
const mediaInfo = getMediaInfo(target);
// Check for links (but not if it's media)
const linkElement = target && typeof target.closest === 'function' ? target.closest("a") : null;
const linkElement =
target && typeof target.closest === "function"
? target.closest("a")
: null;
const isLink = linkElement && linkElement.href && !mediaInfo.isMedia;
// Only show custom menu for media or links