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.

refactor: tighten CLI helpers and sync lockfile

Tw93ea026c42a7fa
diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.ts
index a667e354..a5a45a7e 100644
--- a/bin/helpers/merge.ts
+++ b/bin/helpers/merge.ts
@@ -236,8 +236,10 @@ async function mergeIcons(
);
logger.warn(`✼ Default system tray icon will be used.`);
}
- } catch {
- logger.warn(`✼ ${options.systemTrayIcon} not exists!`);
+ } catch (err) {
+ logger.warn(
+ `✼ Failed to apply system tray icon "${options.systemTrayIcon}": ${err instanceof Error ? err.message : String(err)}`,
+ );
logger.warn(`✼ Default system tray icon will remain unchanged.`);
}
}
diff --git a/bin/options/icon.ts b/bin/options/icon.ts
index c767411c..a068fb87 100644
--- a/bin/options/icon.ts
+++ b/bin/options/icon.ts
@@ -211,9 +211,10 @@ async function convertIconFormat(
platformOutputDir,
`${iconName}_256${PLATFORM_CONFIG.win.format}`,
);
+ const sourceBuffer = await fsExtra.readFile(processedInputPath);
const frames = await Promise.all(
(PLATFORM_CONFIG.win.sizes as number[]).map(async (size) => {
- const png = await sharp(processedInputPath)
+ const png = await sharp(sourceBuffer)
.resize(size, size, {
fit: 'contain',
background: { r: 0, g: 0, b: 0, alpha: 0 },
diff --git a/bin/utils/ico.ts b/bin/utils/ico.ts
index 33f59070..c082cba8 100644
--- a/bin/utils/ico.ts
+++ b/bin/utils/ico.ts
@@ -5,7 +5,7 @@ const ICO_HEADER_SIZE = 6;
const ICO_DIR_ENTRY_SIZE = 16;
const ICO_TYPE_ICON = 1;
-export type IcoEntry = {
+type IcoEntry = {
index: number;
width: number;
height: number;
@@ -46,7 +46,7 @@ function compareByPreferredSize(
};
}
-export function parseIcoBuffer(buffer: Buffer): IcoEntry[] {
+function parseIcoBuffer(buffer: Buffer): IcoEntry[] {
if (buffer.length < ICO_HEADER_SIZE) {
throw new Error('Invalid ICO: header too short.');
}
@@ -93,7 +93,7 @@ export function parseIcoBuffer(buffer: Buffer): IcoEntry[] {
return entries;
}
-export function buildReorderedIcoBuffer(
+function buildReorderedIcoBuffer(
buffer: Buffer,
preferredSize: number,
): Buffer {
diff --git a/dist/cli.js b/dist/cli.js
index 8560dcf8..782a5bde 100644
--- a/dist/cli.js
+++ b/dist/cli.js
@@ -110,7 +110,8 @@ var devDependencies = {
};
var pnpm = {
overrides: {
- sharp: "^0.34.5"
+ sharp: "^0.34.5",
+ "@img/sharp-libvips-darwin-arm64": "1.2.4"
},
onlyBuiltDependencies: [
"esbuild",
@@ -650,8 +651,8 @@ async function mergeIcons(options, name, tauriConf, platform, safeAppName) {
logger.warn(`✼ Default system tray icon will be used.`);
}
}
- catch {
- logger.warn(`✼ ${options.systemTrayIcon} not exists!`);
+ catch (err) {
+ logger.warn(`✼ Failed to apply system tray icon "${options.systemTrayIcon}": ${err instanceof Error ? err.message : String(err)}`);
logger.warn(`✼ Default system tray icon will remain unchanged.`);
}
}
@@ -1810,8 +1811,9 @@ async function convertIconFormat(inputPath, appName) {
// Generate platform-specific format
if (IS_WIN) {
const icoPath = path.join(platformOutputDir, `${iconName}_256${PLATFORM_CONFIG.win.format}`);
+ const sourceBuffer = await fsExtra.readFile(processedInputPath);
const frames = await Promise.all(PLATFORM_CONFIG.win.sizes.map(async (size) => {
- const png = await sharp(processedInputPath)
+ const png = await sharp(sourceBuffer)
.resize(size, size, {
fit: 'contain',
background: { r: 0, g: 0, b: 0, alpha: 0 },
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 695b489e..2648b74e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -6,6 +6,7 @@ settings:
overrides:
sharp: ^0.34.5
+ '@img/sharp-libvips-darwin-arm64': 1.2.4
importers: