pake-cli添加Linux appimage格式

This commit is contained in:
Tlntin
2022-12-10 22:43:31 +08:00
parent 6dfa8e7a2f
commit ebc90798b0
3 changed files with 27 additions and 10 deletions

1
.gitignore vendored
View File

@@ -26,6 +26,7 @@ dist-ssr
output output
*.msi *.msi
*.deb *.deb
*.AppImage
*.dmg *.dmg
package-lock.json package-lock.json

View File

@@ -69,19 +69,28 @@ Type=Application
arch = process.arch; arch = process.arch;
} }
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
const appPath = this.getBuildedAppPath(npmDirectory, debName); const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName);
const distPath = path.resolve(`${name}.deb`); const distPath = path.resolve(`${name}.deb`);
await fs.copyFile(appPath, distPath); await fs.copyFile(appPath, distPath);
await fs.unlink(appPath); await fs.unlink(appPath);
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName);
const distAppPath = path.resolve(`${name}.AppImage`);
await fs.copyFile(appImagePath, distAppPath);
await fs.unlink(appImagePath);
logger.success('Build success!'); logger.success('Build success!');
logger.success('You can find the app installer in', distPath); logger.success('You can find the deb app installer in', distPath);
logger.success('You can find the Appimage app installer in', distAppPath);
} }
getBuildedAppPath(npmDirectory: string, dmgName: string) { getBuildedAppPath(npmDirectory: string,packageType: string, packageName: string) {
return path.join( return path.join(
npmDirectory, npmDirectory,
'src-tauri/target/release/bundle/deb', 'src-tauri/target/release/bundle/',
dmgName packageType,
packageName
); );
} }
} }

17
dist/cli.js vendored
View File

@@ -1943,7 +1943,8 @@ var tauri = {
], ],
shortDescription: "", shortDescription: "",
targets: [ targets: [
"deb" "deb",
"appimage"
] ]
} }
}; };
@@ -2115,16 +2116,22 @@ Type=Application
arch = process.arch; arch = process.arch;
} }
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
const appPath = this.getBuildedAppPath(npmDirectory, debName); const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName);
const distPath = path.resolve(`${name}.deb`); const distPath = path.resolve(`${name}.deb`);
yield fs.copyFile(appPath, distPath); yield fs.copyFile(appPath, distPath);
yield fs.unlink(appPath); yield fs.unlink(appPath);
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName);
const distAppPath = path.resolve(`${name}.AppImage`);
yield fs.copyFile(appImagePath, distAppPath);
yield fs.unlink(appImagePath);
logger.success('Build success!'); logger.success('Build success!');
logger.success('You can find the app installer in', distPath); logger.success('You can find the deb app installer in', distPath);
logger.success('You can find the Appimage app installer in', distAppPath);
}); });
} }
getBuildedAppPath(npmDirectory, dmgName) { getBuildedAppPath(npmDirectory, packageType, packageName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/deb', dmgName); return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName);
} }
} }