Pake-cli adds the parameter to select the packaging format.
This commit is contained in:
32
bin/builders/LinuxBuilder.ts
vendored
32
bin/builders/LinuxBuilder.ts
vendored
@@ -54,20 +54,24 @@ export default class LinuxBuilder implements IBuilder {
|
||||
} else {
|
||||
arch = process.arch;
|
||||
}
|
||||
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
|
||||
const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
|
||||
const distPath = path.resolve(`${name}.deb`);
|
||||
await fs.copyFile(appPath, distPath);
|
||||
await fs.unlink(appPath);
|
||||
|
||||
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
|
||||
const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
|
||||
const distAppPath = path.resolve(`${name}.AppImage`);
|
||||
await fs.copyFile(appImagePath, distAppPath);
|
||||
await fs.unlink(appImagePath);
|
||||
logger.success('Build success!');
|
||||
logger.success('You can find the deb app installer in', distPath);
|
||||
logger.success('You can find the AppImage app installer in', distAppPath);
|
||||
if (options.targets === "deb" || options.targets === "all") {
|
||||
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
|
||||
const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
|
||||
const distPath = path.resolve(`${name}.deb`);
|
||||
await fs.copyFile(appPath, distPath);
|
||||
await fs.unlink(appPath);
|
||||
logger.success('Build Deb success!');
|
||||
logger.success('You can find the deb app installer in', distPath);
|
||||
}
|
||||
if (options.targets === "appimage" || options.targets === "all") {
|
||||
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
|
||||
const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
|
||||
const distAppPath = path.resolve(`${name}.AppImage`);
|
||||
await fs.copyFile(appImagePath, distAppPath);
|
||||
await fs.unlink(appImagePath);
|
||||
logger.success('Build AppImage success!');
|
||||
logger.success('You can find the AppImage app installer in', distAppPath);
|
||||
}
|
||||
}
|
||||
|
||||
getBuildAppPath(npmDirectory: string, packageType: string, packageName: string) {
|
||||
|
||||
9
bin/builders/common.ts
vendored
9
bin/builders/common.ts
vendored
@@ -82,6 +82,11 @@ export async function mergeTauriConfig(
|
||||
updateIconPath = false;
|
||||
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
|
||||
}
|
||||
if (["all", "deb", "appimage"].includes(options.targets)) {
|
||||
tauriConf.tauri.bundle.targets = [options.targets];
|
||||
} else {
|
||||
logger.warn("targets must be 'all', 'deb', 'appimage', we will use default 'all'");
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === "darwin" && customIconExt !== ".icns") {
|
||||
@@ -117,13 +122,13 @@ export async function mergeTauriConfig(
|
||||
let bundleConf = {tauri: {bundle: tauriConf.tauri.bundle}};
|
||||
await fs.writeFile(
|
||||
configPath,
|
||||
Buffer.from(JSON.stringify(bundleConf), 'utf-8')
|
||||
Buffer.from(JSON.stringify(bundleConf, null, '\t'), 'utf-8')
|
||||
);
|
||||
|
||||
|
||||
const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json')
|
||||
await fs.writeFile(
|
||||
configJsonPath,
|
||||
Buffer.from(JSON.stringify(tauriConf), 'utf-8')
|
||||
Buffer.from(JSON.stringify(tauriConf, null, '\t'), 'utf-8')
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user