Add releaseVersion to manifest
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -23,6 +23,7 @@ const VERSIONS_DOMAIN = 'https://versions.backstage.io';
|
||||
* @public
|
||||
*/
|
||||
export type ReleaseManifest = {
|
||||
releaseVersion: string;
|
||||
packages: { name: string; version: string }[];
|
||||
};
|
||||
|
||||
@@ -41,7 +42,9 @@ export type GetByVersionOptions = {
|
||||
export async function getByVersion(
|
||||
options: GetByVersionOptions,
|
||||
): Promise<ReleaseManifest> {
|
||||
const url = `${VERSIONS_DOMAIN}/v1/releases/${options.version}/manifest.json`;
|
||||
const url = `${VERSIONS_DOMAIN}/v1/releases/${encodeURIComponent(
|
||||
options.version,
|
||||
)}/manifest.json`;
|
||||
const response = await fetch(url);
|
||||
if (response.status === 404) {
|
||||
throw new Error(`No release found for ${options.version} version`);
|
||||
@@ -69,7 +72,9 @@ export type GetByReleaseLineOptions = {
|
||||
export async function getByReleaseLine(
|
||||
options: GetByReleaseLineOptions,
|
||||
): Promise<ReleaseManifest> {
|
||||
const url = `${VERSIONS_DOMAIN}/v1/tags/${options.releaseLine}/manifest.json`;
|
||||
const url = `${VERSIONS_DOMAIN}/v1/tags/${encodeURIComponent(
|
||||
options.releaseLine,
|
||||
)}/manifest.json`;
|
||||
const response = await fetch(url);
|
||||
if (response.status === 404) {
|
||||
throw new Error(`No '${options.releaseLine}' release line found`);
|
||||
|
||||
Reference in New Issue
Block a user