Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

Auto-fix formatting issues

GitHub Action2925b2f56b1d
diff --git a/CLAUDE.md b/CLAUDE.md
index 427dda5b..d5575c64 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -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
diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.ts
index d9b96d34..7c3da7ac 100644
--- a/bin/helpers/merge.ts
+++ b/bin/helpers/merge.ts
@@ -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();
diff --git a/bin/options/icon.ts b/bin/options/icon.ts
index 4664bf05..c9fe6dc5 100644
--- a/bin/options/icon.ts
+++ b/bin/options/icon.ts
@@ -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) {
diff --git a/bin/utils/name.ts b/bin/utils/name.ts
index 2d7ded76..0768166b 100644
--- a/bin/utils/name.ts
+++ b/bin/utils/name.ts
@@ -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);
-}
\ No newline at end of file
+ return name.replace(/[:]/g, '_').slice(0, 255);
+}
diff --git a/src-tauri/src/inject/event.js b/src-tauri/src/inject/event.js
index e96346ba..3d1794f6 100644
--- a/src-tauri/src/inject/event.js
+++ b/src-tauri/src/inject/event.js
@@ -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