-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the release package to the hovercard
- Loading branch information
Showing
5 changed files
with
56 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import {Release} from '@sentry/release-parser'; | ||
import {parseVersion} from './parseVersion'; | ||
|
||
export const formatVersion = (rawVersion: string, withPackage = false) => { | ||
try { | ||
const parsedVersion = new Release(rawVersion); | ||
const versionToDisplay = parsedVersion.describe(); | ||
const parsedVersion = parseVersion(rawVersion); | ||
if (!parsedVersion) { | ||
return rawVersion; | ||
} | ||
|
||
if (versionToDisplay.length) { | ||
return `${versionToDisplay}${withPackage && parsedVersion.package ? `, ${parsedVersion.package}` : ''}`; | ||
} | ||
const versionToDisplay = parsedVersion.describe(); | ||
|
||
return rawVersion; | ||
} catch { | ||
return rawVersion; | ||
if (versionToDisplay.length) { | ||
return `${versionToDisplay}${withPackage && parsedVersion.package ? `, ${parsedVersion.package}` : ''}`; | ||
} | ||
|
||
return rawVersion; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
import {Release} from '@sentry/release-parser'; | ||
import {parseVersion} from 'sentry/utils/versions/parseVersion'; | ||
|
||
export const isSemverRelease = (rawVersion: string): boolean => { | ||
try { | ||
const parsedVersion = new Release(rawVersion); | ||
return !!parsedVersion.versionParsed; | ||
} catch { | ||
return false; | ||
} | ||
const parsedVersion = parseVersion(rawVersion); | ||
return !!parsedVersion?.versionParsed; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {Release} from '@sentry/release-parser'; | ||
|
||
export function parseVersion(rawVersion: string): Release | null { | ||
try { | ||
const parsedVersion = new Release(rawVersion); | ||
return parsedVersion; | ||
} catch { | ||
return null; | ||
} | ||
} |