🐛 Fix the packaging file problem under Linux
This commit is contained in:
15
bin/helpers/merge.ts
vendored
15
bin/helpers/merge.ts
vendored
@@ -160,15 +160,16 @@ MimeType=text/html;text/xml;application/xhtml_xml;
|
|||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// Write desktop file to assets directory
|
// Write desktop file to src-tauri/assets directory where Tauri expects it
|
||||||
const assetsDir = path.join(npmDirectory, 'src-tauri/assets');
|
const srcAssetsDir = path.join(npmDirectory, 'src-tauri/assets');
|
||||||
const desktopFilePath = path.join(assetsDir, desktopFileName);
|
const srcDesktopFilePath = path.join(srcAssetsDir, desktopFileName);
|
||||||
await fsExtra.ensureDir(assetsDir);
|
await fsExtra.ensureDir(srcAssetsDir);
|
||||||
await fsExtra.writeFile(desktopFilePath, desktopContent);
|
await fsExtra.writeFile(srcDesktopFilePath, desktopContent);
|
||||||
|
|
||||||
// Set up desktop file in bundle configuration
|
// Set up desktop file in bundle configuration
|
||||||
|
// Use relative path from .pake directory to assets
|
||||||
tauriConf.bundle.linux.deb.files = {
|
tauriConf.bundle.linux.deb.files = {
|
||||||
[`/usr/share/applications/${desktopFileName}`]: `assets/${desktopFileName}`,
|
[`/usr/share/applications/${desktopFileName}`]: `../assets/${desktopFileName}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
const validTargets = ['deb', 'appimage', 'rpm'];
|
const validTargets = ['deb', 'appimage', 'rpm'];
|
||||||
@@ -203,7 +204,7 @@ StartupNotify=true
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const iconInfo = platformIconMap[platform];
|
const iconInfo = platformIconMap[platform];
|
||||||
const exists = await fsExtra.pathExists(options.icon);
|
const exists = options.icon && (await fsExtra.pathExists(options.icon));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
let updateIconPath = true;
|
let updateIconPath = true;
|
||||||
let customIconExt = path.extname(options.icon).toLowerCase();
|
let customIconExt = path.extname(options.icon).toLowerCase();
|
||||||
|
|||||||
25
dist/cli.js
vendored
25
dist/cli.js
vendored
@@ -22,7 +22,7 @@ import sharp from 'sharp';
|
|||||||
import * as psl from 'psl';
|
import * as psl from 'psl';
|
||||||
|
|
||||||
var name = "pake-cli";
|
var name = "pake-cli";
|
||||||
var version = "3.2.5";
|
var version = "3.2.6";
|
||||||
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
|
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
|
||||||
var engines = {
|
var engines = {
|
||||||
node: ">=16.0.0"
|
node: ">=16.0.0"
|
||||||
@@ -425,14 +425,15 @@ Categories=Network;WebBrowser;
|
|||||||
MimeType=text/html;text/xml;application/xhtml_xml;
|
MimeType=text/html;text/xml;application/xhtml_xml;
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
`;
|
`;
|
||||||
// Write desktop file to assets directory
|
// Write desktop file to src-tauri/assets directory where Tauri expects it
|
||||||
const assetsDir = path.join(npmDirectory, 'src-tauri/assets');
|
const srcAssetsDir = path.join(npmDirectory, 'src-tauri/assets');
|
||||||
const desktopFilePath = path.join(assetsDir, desktopFileName);
|
const srcDesktopFilePath = path.join(srcAssetsDir, desktopFileName);
|
||||||
await fsExtra.ensureDir(assetsDir);
|
await fsExtra.ensureDir(srcAssetsDir);
|
||||||
await fsExtra.writeFile(desktopFilePath, desktopContent);
|
await fsExtra.writeFile(srcDesktopFilePath, desktopContent);
|
||||||
// Set up desktop file in bundle configuration
|
// Set up desktop file in bundle configuration
|
||||||
|
// Use relative path from .pake directory to assets
|
||||||
tauriConf.bundle.linux.deb.files = {
|
tauriConf.bundle.linux.deb.files = {
|
||||||
[`/usr/share/applications/${desktopFileName}`]: `assets/${desktopFileName}`,
|
[`/usr/share/applications/${desktopFileName}`]: `../assets/${desktopFileName}`,
|
||||||
};
|
};
|
||||||
const validTargets = ['deb', 'appimage', 'rpm'];
|
const validTargets = ['deb', 'appimage', 'rpm'];
|
||||||
if (validTargets.includes(options.targets)) {
|
if (validTargets.includes(options.targets)) {
|
||||||
@@ -464,7 +465,7 @@ StartupNotify=true
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
const iconInfo = platformIconMap[platform];
|
const iconInfo = platformIconMap[platform];
|
||||||
const exists = await fsExtra.pathExists(options.icon);
|
const exists = options.icon && (await fsExtra.pathExists(options.icon));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
let updateIconPath = true;
|
let updateIconPath = true;
|
||||||
let customIconExt = path.extname(options.icon).toLowerCase();
|
let customIconExt = path.extname(options.icon).toLowerCase();
|
||||||
@@ -964,8 +965,9 @@ async function handleIcon(options, url) {
|
|||||||
logger.warn('✼ Using png as fallback for Windows (may cause issues).');
|
logger.warn('✼ Using png as fallback for Windows (may cause issues).');
|
||||||
return defaultPngPath;
|
return defaultPngPath;
|
||||||
}
|
}
|
||||||
// If nothing exists, let the error bubble up
|
// If nothing exists, return empty string to let merge.ts handle default icon
|
||||||
throw new Error('No default icon found for Windows build');
|
logger.warn('✼ No default icon found, will use pake default.');
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
const iconPath = IS_LINUX
|
const iconPath = IS_LINUX
|
||||||
? 'src-tauri/png/icon_512.png'
|
? 'src-tauri/png/icon_512.png'
|
||||||
@@ -1163,7 +1165,8 @@ async function handleOptions(options, url) {
|
|||||||
name,
|
name,
|
||||||
identifier: getIdentifier(url),
|
identifier: getIdentifier(url),
|
||||||
};
|
};
|
||||||
appOptions.icon = await handleIcon(appOptions, url);
|
const iconPath = await handleIcon(appOptions, url);
|
||||||
|
appOptions.icon = iconPath || undefined;
|
||||||
return appOptions;
|
return appOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "pake-cli",
|
"name": "pake-cli",
|
||||||
"version": "3.2.3",
|
"version": "3.2.5",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pake-cli",
|
"name": "pake-cli",
|
||||||
"version": "3.2.3",
|
"version": "3.2.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.8.0",
|
"@tauri-apps/api": "^2.8.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pake-cli",
|
"name": "pake-cli",
|
||||||
"version": "3.2.5",
|
"version": "3.2.6",
|
||||||
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
|
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user