Skip to content

Commit 37db080

Browse files
authored
fix(linux): make semver pre-release versions valid for "pacman" and "rpm" target (#7630)
1 parent b3dfe64 commit 37db080

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.changeset/honest-comics-bake.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix(linux): make semver pre-release versions valid for `"pacman"` and `"rpm"` target

packages/app-builder-lib/src/targets/FpmTarget.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export default class FpmTarget extends Target {
152152
"--description",
153153
smarten(target === "rpm" ? this.helper.getDescription(options)! : `${synopsis || ""}\n ${this.helper.getDescription(options)}`),
154154
"--version",
155-
appInfo.version,
155+
this.helper.getSanitizedVersion(target),
156156
"--package",
157157
artifactPath,
158158
]

packages/app-builder-lib/src/targets/LinuxTargetHelper.ts

+14
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ export class LinuxTargetHelper {
7676
return options.description || this.packager.appInfo.description
7777
}
7878

79+
getSanitizedVersion(target: string) {
80+
const {
81+
appInfo: { version },
82+
} = this.packager
83+
switch (target) {
84+
case "pacman":
85+
return version.replace(/-/g, "_")
86+
case "rpm":
87+
return version.replace(/-/g, "~")
88+
default:
89+
return version
90+
}
91+
}
92+
7993
async writeDesktopEntry(targetSpecificOptions: LinuxTargetSpecificOptions, exec?: string, destination?: string | null, extra?: { [key: string]: string }): Promise<string> {
8094
const data = await this.computeDesktopEntry(targetSpecificOptions, exec, extra)
8195
const file = destination || (await this.packager.getTempFile(`${this.packager.appInfo.productFilename}.desktop`))

0 commit comments

Comments
 (0)