🎨 Fix the packaging issue for Linux and Windows

This commit is contained in:
Tw93
2023-06-23 18:12:10 +08:00
parent 2e020a6528
commit aa0964e2c1
6 changed files with 72 additions and 90 deletions

View File

@@ -3,29 +3,31 @@ import { PakeAppOptions } from '@/types';
import tauriConfig from '@/helpers/tauriConfig';
export default class LinuxBuilder extends BaseBuilder {
constructor(options: PakeAppOptions) {
super(options);
}
getFileName(): string {
const { name } = this.options;
const arch = process.arch === "x64" ? "amd64" : process.arch;
return `${name}_${tauriConfig.package.version}_${arch}`;
}
// Customize it, considering that there are all targets.
async build(url: string) {
const targetTypes = ['deb', 'appimage'];
for (const type of targetTypes) {
if (this.options.targets === type || this.options.targets === "all") {
await this.buildAndCopy(url);
const targetTypes = ["deb", "appimage"];
for (const target of targetTypes) {
if (this.options.targets === target || this.options.targets === "all") {
await this.buildAndCopy(url, target);
}
}
}
getFileName(): string {
const { name } = this.options;
const arch = this.getArch();
return `${name}_${tauriConfig.package.version}_${arch}`;
}
getExtension(): string {
if (this.options.targets === 'appimage') {
protected getFileType(target: string): string {
if (target === 'appimage') {
return 'AppImage';
}
return this.options.targets;
return super.getFileType(target);
}
}