更新pake-cli,增加Linux端targets选项,增加打包本地文件功能

This commit is contained in:
Tlntin
2022-12-29 11:05:25 +08:00
parent 6d69b1144c
commit c7717ffda5
8 changed files with 647 additions and 29 deletions

View File

@@ -75,15 +75,17 @@ export async function mergeTauriConfig(
// } else {
// fs.rm
// }
const url_exists = await fs.stat(url)
let file_path = url.slice(8, url.length);
const url_exists = await fs.stat(file_path)
.then(() => true)
.catch(() => false);
if (url_exists) {
logger.warn("you input may a local file");
tauriConf.pake.windows[0].url_type = "local";
const file_name = path.basename(url);
const file_name = path.basename(file_path);
// const dir_name = path.dirname(url);
const url_path = path.join("dist/", file_name);
await fs.copyFile(url, url_path);
await fs.copyFile(file_path, url_path);
tauriConf.pake.windows[0].url = file_name;
tauriConf.pake.windows[0].url_type = "local";
} else {
@@ -160,6 +162,17 @@ export async function mergeTauriConfig(
}
}
// 处理targets 暂时只对linux开放
if (process.platform === "linux") {
if (options.targets.length > 0) {
if (options.targets === "deb" || options.targets === "appimage" || options.targets === "all") {
tauriConf.tauri.bundle.targets = [options.targets];
}
}
} else {
tauriConf.tauri.bundle.targets = ["deb"];
}
tauriConf.package.productName = name;
tauriConf.tauri.bundle.identifier = identifier;