Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
fix(icon): ship the .icns when Assets.car cannot be compiled
Tw93ec5af5c3c90c
diff --git a/bin/helpers/icon-composer.ts b/bin/helpers/icon-composer.tsindex 3cbcf34a..6d30df50 100644--- a/bin/helpers/icon-composer.ts+++ b/bin/helpers/icon-composer.ts@@ -202,21 +202,8 @@ export async function precompileIconComposerAssets(return dest;}- // Xcode 27.1+ sometimes leaves ibtoold in a bad state (tauri-apps/tauri#16386).logger.warn(- '✼ actool failed to compile the .icon package; retrying after stopping ibtoold (tauri-apps/tauri#16386).',- );- await execa('pkill', ['-x', 'ibtoold'], {- stdin: 'ignore',- reject: false,- });-- if (await compileAssetsCar(iconPackagePath, dest)) {- return dest;- }-- logger.warn(- '✼ Could not precompile Assets.car. The .icon will be passed to Tauri, which may hit the same actool issue (tauri-apps/tauri#15315, #16386). The .icns fallback stays in bundle.icon.',+ '✼ actool could not compile the .icon package (tauri-apps/tauri#15315, #16386). The app will use the .icns icon instead.',);return null;}@@ -281,15 +268,19 @@ export async function applyDarwinIconComposerPackage(options: {destIconsDir,);+ // Tauri runs actool itself for a .icon in bundle.icon and fails the whole+ // build when actool errors, so only a precompiled Assets.car goes in; when+ // that could not be built, the app ships with the .icns alone.const bundleIcon: string[] = [];if (compiledCar) {logger.info('✼ Precompiled Assets.car from the Icon Composer package.');bundleIcon.push('icons/Assets.car');- } else {- bundleIcon.push(`icons/${safeAppName}.icon`);}if (hasIcns) {bundleIcon.push(`icons/${safeAppName}.icns`);}+ if (bundleIcon.length === 0) {+ bundleIcon.push(`icons/${safeAppName}.icon`);+ }return { bundleIcon };}diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.tsindex 15965aa5..d469c63b 100644--- a/bin/helpers/merge.ts+++ b/bin/helpers/merge.ts@@ -436,7 +436,11 @@ export async function mergeIcons(defaultIcnsPath,});tauriConf.bundle.icon = bundleIcon;- tauriConf.bundle.resources = bundleIcon;+ // Assets.car is read from bundle.icon; copying it into resources too+ // would store it twice. Keep the .icns resource the plain path ships.+ tauriConf.bundle.resources = bundleIcon.filter((icon) =>+ icon.endsWith('.icns'),+ );composerIconApplied = true;}} else if (customIconExt !== iconInfo.fileExt) {diff --git a/dist/cli.js b/dist/cli.jsindex 3e3e92af..24baf265 100644--- a/dist/cli.js+++ b/dist/cli.js@@ -1099,16 +1099,7 @@ async function precompileIconComposerAssets(iconPackagePath, destIconsDir) {if (await compileAssetsCar(iconPackagePath, dest)) {return dest;}- // Xcode 27.1+ sometimes leaves ibtoold in a bad state (tauri-apps/tauri#16386).- logger.warn('✼ actool failed to compile the .icon package; retrying after stopping ibtoold (tauri-apps/tauri#16386).');- await execa('pkill', ['-x', 'ibtoold'], {- stdin: 'ignore',- reject: false,- });- if (await compileAssetsCar(iconPackagePath, dest)) {- return dest;- }- logger.warn('✼ Could not precompile Assets.car. The .icon will be passed to Tauri, which may hit the same actool issue (tauri-apps/tauri#15315, #16386). The .icns fallback stays in bundle.icon.');+ logger.warn('✼ actool could not compile the .icon package (tauri-apps/tauri#15315, #16386). The app will use the .icns icon instead.');return null;}/**@@ -1147,17 +1138,20 @@ async function applyDarwinIconComposerPackage(options) {}await warnIfActoolUnavailable();const compiledCar = await precompileIconComposerAssets(destIconPackage, destIconsDir);+ // Tauri runs actool itself for a .icon in bundle.icon and fails the whole+ // build when actool errors, so only a precompiled Assets.car goes in; when+ // that could not be built, the app ships with the .icns alone.const bundleIcon = [];if (compiledCar) {logger.info('✼ Precompiled Assets.car from the Icon Composer package.');bundleIcon.push('icons/Assets.car');}- else {- bundleIcon.push(`icons/${safeAppName}.icon`);- }if (hasIcns) {bundleIcon.push(`icons/${safeAppName}.icns`);}+ if (bundleIcon.length === 0) {+ bundleIcon.push(`icons/${safeAppName}.icon`);+ }return { bundleIcon };}@@ -1462,7 +1456,9 @@ async function mergeIcons(options, name, tauriConf, platform, safeAppName) {defaultIcnsPath,});tauriConf.bundle.icon = bundleIcon;- tauriConf.bundle.resources = bundleIcon;+ // Assets.car is read from bundle.icon; copying it into resources too+ // would store it twice. Keep the .icns resource the plain path ships.+ tauriConf.bundle.resources = bundleIcon.filter((icon) => icon.endsWith('.icns'));composerIconApplied = true;}}diff --git a/docs/cli-usage.md b/docs/cli-usage.mdindex a43e7bd2..f4cfe03e 100644--- a/docs/cli-usage.md+++ b/docs/cli-usage.md@@ -132,7 +132,7 @@ Supports both local and remote files, automatically converts to platform-specifiIf you pass a `.icon`, also put a sibling `.icns` of the same basename for macOS versions before 26. If there isn't one, Pake uses its default `icon.icns`. A `.icon` is a local package, not a URL. Compiling Liquid Glass appearances needs Xcode 26+ (`actool` short version 26 or newer) on the machine that runs `pake`. If `actool` is missing or too old, Pake warns and uses the `.icns` fallback.-On some Xcode 27 setups, Tauri's bundler fails when it runs `actool` (tauri-apps/tauri#15315, #16386). Pake tries to precompile `Assets.car` itself first, with stdin closed, and retries once after stopping `ibtoold`. If that fails, the `.icon` is still passed to Tauri, and the `.icns` fallback stays in `bundle.icon`.+On some Xcode 27 setups, Tauri's bundler fails when it runs `actool` itself (tauri-apps/tauri#15315, #16386), so Pake compiles `Assets.car` first, with stdin closed, and hands Tauri the compiled file. If that compile fails, the build goes on with the `.icns` alone.```shell--icon <path>diff --git a/docs/cli-usage_CN.md b/docs/cli-usage_CN.mdindex e82a53ee..5525b99f 100644--- a/docs/cli-usage_CN.md+++ b/docs/cli-usage_CN.md@@ -132,7 +132,7 @@ pake ./dist --name MyTool传入 `.icon` 时,请在同目录放一个同名的 `.icns`,给 macOS 26 以下的系统做回退;没有的话会用 Pake 自带的默认 `icon.icns`。`.icon` 只能是本地包,不能通过 URL 下载。编译 Liquid Glass 外观需要打包机器上有 Xcode 26+(`actool` 主版本不低于 26);找不到或版本过低时,会给出警告并使用 `.icns` 回退。-在部分 Xcode 27 环境里,Tauri 打包过程调用 `actool` 可能失败(tauri-apps/tauri#15315、#16386)。Pake 会先自行预编译 `Assets.car`(关闭 stdin),失败时停掉 `ibtoold` 再试一次;仍失败就把 `.icon` 交给 Tauri,同时保留 `.icns` 回退。+在部分 Xcode 27 环境里,Tauri 打包时自己调用 `actool` 可能失败(tauri-apps/tauri#15315、#16386),所以 Pake 会先自行编译 `Assets.car`(关闭 stdin),再把编译好的文件交给 Tauri,编译失败时只用 `.icns` 继续打包。```shell--icon <path>diff --git a/llms.txt b/llms.txtindex 305bf64d..404d60fe 100644--- a/llms.txt+++ b/llms.txt@@ -38,6 +38,6 @@ Do not recommend Pake as a replacement for a fully native application when deep## Notes- Output formats: dmg/app (macOS), msi (Windows), deb/AppImage/rpm/zst (Linux); pick with `--targets`.-- Icons auto-fetch from the site favicon when `--icon` is omitted. On macOS, `--icon` also accepts a local Icon Composer `.icon` package, which is passed to Tauri together with an `.icns` fallback (a sibling file of the same basename, or Pake's default). A `.icon` cannot be fetched from a URL. Compiling appearance variants needs Xcode 26+ `actool`.+- Icons auto-fetch from the site favicon when `--icon` is omitted. On macOS, `--icon` also accepts a local Icon Composer `.icon` package, compiled into the app's `Assets.car` with an `.icns` fallback (a sibling file of the same basename, or Pake's default); when the compile fails the app ships with the `.icns` alone. A `.icon` cannot be fetched from a URL. Compiling appearance variants needs Xcode 26+ `actool`.- `--proxy-url` is baked into the app webview at build time; it does not proxy the icon download itself.- Google OAuth and similar providers may reject embedded webviews regardless of flags; `--new-window` and `--safe-domain` help with most SSO flows.diff --git a/tests/unit/icon-composer.test.ts b/tests/unit/icon-composer.test.tsindex 1047836c..2bf45211 100644--- a/tests/unit/icon-composer.test.ts+++ b/tests/unit/icon-composer.test.ts@@ -44,7 +44,10 @@ async function makeIconPackage(fill: 'automatic',groups: [],});- await fsExtra.writeFile(path.join(pkg, 'Assets', 'icon.png'), Buffer.from([1, 2, 3, 4]));+ await fsExtra.writeFile(+ path.join(pkg, 'Assets', 'icon.png'),+ Buffer.from([1, 2, 3, 4]),+ );return pkg;}@@ -137,7 +140,7 @@ describe('parseActoolVersion', () => {});describe('applyDarwinIconComposerPackage', () => {- it('sets bundle.icon to the .icon package and a sibling .icns', async () => {+ it('ships only a sibling .icns when Assets.car could not be precompiled', async () => {const root = await makeTempDir();const pkg = await makeIconPackage(root);await fsExtra.writeFile(path.join(root, 'AppIcon.icns'), 'sibling-icns');@@ -152,16 +155,15 @@ describe('applyDarwinIconComposerPackage', () => {defaultIcnsPath: defaultIcns,});- expect(bundleIcon).toEqual([- 'icons/weekly.icon',- 'icons/weekly.icns',- ]);- expect(await fsExtra.pathExists(path.join(destIconsDir, 'weekly.icon', 'icon.json'))).toBe(- true,- );- expect(await fsExtra.readFile(path.join(destIconsDir, 'weekly.icns'), 'utf8')).toBe(- 'sibling-icns',- );+ expect(bundleIcon).toEqual(['icons/weekly.icns']);+ expect(+ await fsExtra.pathExists(+ path.join(destIconsDir, 'weekly.icon', 'icon.json'),+ ),+ ).toBe(true);+ expect(+ await fsExtra.readFile(path.join(destIconsDir, 'weekly.icns'), 'utf8'),+ ).toBe('sibling-icns');});it('uses the default .icns when there is no sibling file', async () => {@@ -178,13 +180,10 @@ describe('applyDarwinIconComposerPackage', () => {defaultIcnsPath: defaultIcns,});- expect(bundleIcon).toEqual([- 'icons/weekly.icon',- 'icons/weekly.icns',- ]);- expect(await fsExtra.readFile(path.join(destIconsDir, 'weekly.icns'), 'utf8')).toBe(- 'default-icns',- );+ expect(bundleIcon).toEqual(['icons/weekly.icns']);+ expect(+ await fsExtra.readFile(path.join(destIconsDir, 'weekly.icns'), 'utf8'),+ ).toBe('default-icns');});});@@ -207,10 +206,16 @@ describe('precompileIconComposerAssets', () => {if (compileAt >= 0) {const outputPath = args[compileAt + 1];await fsExtra.ensureDir(outputPath);- await fsExtra.writeFile(path.join(outputPath, 'Assets.car'), 'compiled-car');+ await fsExtra.writeFile(+ path.join(outputPath, 'Assets.car'),+ 'compiled-car',+ );return { exitCode: 0, stdout: '', stderr: '' };}- if (args.includes('--version') || args.includes('--output-format=human-readable-text')) {+ if (+ args.includes('--version') ||+ args.includes('--output-format=human-readable-text')+ ) {return actoolVersionResult('26.1');}return { exitCode: 0, stdout: '', stderr: '' };@@ -244,36 +249,57 @@ describe('precompileIconComposerAssets', () => {expect(compiled).toBe(false);});- it('retries once after pkill ibtoold when the first compile fails', async () => {+ it('gives up after one failed compile without stopping other processes', async () => {const root = await makeTempDir();const pkg = await makeIconPackage(root);- const destIconsDir = path.join(root, 'dest');let compileAttempts = 0;- execaMock.mockImplementation(async (file: string, args: string[] = []) => {- if (file === 'pkill') {- return { exitCode: 0, stdout: '', stderr: '' };+ execaMock.mockImplementation(async (_file: string, args: string[] = []) => {+ if (args.includes('--compile')) {+ compileAttempts += 1;+ return { exitCode: 1, stdout: '', stderr: 'failed to run actool' };}+ return actoolVersionResult('27.2');+ });++ await expect(+ precompileIconComposerAssets(pkg, path.join(root, 'dest')),+ ).resolves.toBeNull();+ expect(compileAttempts).toBe(1);+ expect(execaMock.mock.calls.some((call) => call[0] === 'pkill')).toBe(+ false,+ );+ });++ it('puts the precompiled Assets.car and the .icns in bundle.icon, never the .icon', async () => {+ const root = await makeTempDir();+ const pkg = await makeIconPackage(root);+ const destIconsDir = path.join(root, 'dest');+ const defaultIcns = path.join(root, 'icon.icns');+ await fsExtra.writeFile(defaultIcns, 'default-icns');++ execaMock.mockImplementation(async (_file: string, args: string[] = []) => {const compileAt = args.indexOf('--compile');if (compileAt >= 0) {- compileAttempts += 1;- if (compileAttempts === 1) {- return { exitCode: 1, stdout: '', stderr: 'failed to run actool' };- }const outputPath = args[compileAt + 1];await fsExtra.ensureDir(outputPath);- await fsExtra.writeFile(path.join(outputPath, 'Assets.car'), 'retry-car');+ await fsExtra.writeFile(+ path.join(outputPath, 'Assets.car'),+ 'compiled-car',+ );return { exitCode: 0, stdout: '', stderr: '' };}- return actoolVersionResult('27.1');+ return actoolVersionResult('27.2');});- const dest = await precompileIconComposerAssets(pkg, destIconsDir);+ const { bundleIcon } = await applyDarwinIconComposerPackage({+ sourceIconPath: pkg,+ destIconsDir,+ safeAppName: 'weekly',+ defaultIcnsPath: defaultIcns,+ });- expect(compileAttempts).toBe(2);- expect(execaMock.mock.calls.some((call) => call[0] === 'pkill')).toBe(true);- expect(dest).toBe(path.join(destIconsDir, 'Assets.car'));- expect(await fsExtra.readFile(dest!, 'utf8')).toBe('retry-car');+ expect(bundleIcon).toEqual(['icons/Assets.car', 'icons/weekly.icns']);});});@@ -283,11 +309,14 @@ describe('mergeIcons on darwin', () => {setBuildDirectory(root);await fsExtra.ensureDir(path.join(root, 'src-tauri/icons'));await fsExtra.ensureDir(path.join(root, 'src-tauri/png'));- await fsExtra.writeFile(path.join(root, 'src-tauri/icons/icon.icns'), 'default-icns');+ await fsExtra.writeFile(+ path.join(root, 'src-tauri/icons/icon.icns'),+ 'default-icns',+ );return root;}- it('passes both the .icon package and a sibling .icns', async () => {+ it('passes a sibling .icns when Assets.car is not available', async () => {const root = await setupNpmDir();const pkg = await makeIconPackage(root);await fsExtra.writeFile(path.join(root, 'AppIcon.icns'), 'sibling-icns');@@ -297,12 +326,13 @@ describe('mergeIcons on darwin', () => {await mergeIcons(makeOptions(pkg, name), name, tauriConf, 'darwin', safe);- expect(tauriConf.bundle.icon).toEqual([- `icons/${safe}.icon`,- `icons/${safe}.icns`,- ]);+ expect(tauriConf.bundle.icon).toEqual([`icons/${safe}.icns`]);+ expect(tauriConf.bundle.resources).toEqual([`icons/${safe}.icns`]);expect(- await fsExtra.readFile(path.join(root, 'src-tauri/icons', `${safe}.icns`), 'utf8'),+ await fsExtra.readFile(+ path.join(root, 'src-tauri/icons', `${safe}.icns`),+ 'utf8',+ ),).toBe('sibling-icns');});@@ -315,13 +345,47 @@ describe('mergeIcons on darwin', () => {await mergeIcons(makeOptions(pkg, name), name, tauriConf, 'darwin', safe);+ expect(tauriConf.bundle.icon).toEqual([`icons/${safe}.icns`]);+ expect(tauriConf.bundle.resources).toEqual([`icons/${safe}.icns`]);+ expect(+ await fsExtra.readFile(+ path.join(root, 'src-tauri/icons', `${safe}.icns`),+ 'utf8',+ ),+ ).toBe('default-icns');+ });++ it('keeps a precompiled Assets.car out of bundle.resources', async () => {+ const root = await setupNpmDir();+ const pkg = await makeIconPackage(root);+ const tauriConf = makeTauriConf();+ const name = 'Weekly';+ const safe = getSafeAppName(name);+ execaMock.mockImplementation(async (_file: string, args: string[] = []) => {+ const compileAt = args.indexOf('--compile');+ if (compileAt >= 0) {+ const outputPath = args[compileAt + 1];+ await fsExtra.ensureDir(outputPath);+ await fsExtra.writeFile(+ path.join(outputPath, 'Assets.car'),+ 'compiled-car',+ );+ return { exitCode: 0, stdout: '', stderr: '' };+ }+ return {+ exitCode: 0,+ stdout: 'short-bundle-version: 27.2\n',+ stderr: '',+ };+ });++ await mergeIcons(makeOptions(pkg, name), name, tauriConf, 'darwin', safe);+expect(tauriConf.bundle.icon).toEqual([- `icons/${safe}.icon`,+ 'icons/Assets.car',`icons/${safe}.icns`,]);- expect(- await fsExtra.readFile(path.join(root, 'src-tauri/icons', `${safe}.icns`), 'utf8'),- ).toBe('default-icns');+ expect(tauriConf.bundle.resources).toEqual([`icons/${safe}.icns`]);});it('keeps a plain .icns icon on the existing path', async () => {