|
1
|
import { toPublicId } from "../../public-id.js" |
|
2
|
import type { BannerDefinition } from "../types.js" |
|
3
|
import { RELEASE_SPEC, type ReleaseSpec } from "./spec.js" |
|
4
|
import { buildRelease, type ReleaseInput } from "./template.js" |
|
5
|
|
|
6
|
/** Normalises a version so the banner always shows the `v` prefix. */ |
|
7
|
export function normalizeVersion(version: string): string { |
|
8
|
return version.startsWith("v") ? version : `v${version}` |
|
9
|
} |
|
10
|
|
|
11
|
/** The banner that heads the release notes for a Medusa version. */ |
|
12
|
export const releaseBanner: BannerDefinition<ReleaseSpec, ReleaseInput> = { |
|
13
|
spec: RELEASE_SPEC, |
|
14
|
folder: "Releases", |
|
15
|
normalize: (input) => ({ |
|
16
|
...input, |
|
17
|
version: normalizeVersion(input.version), |
|
18
|
}), |
|
19
|
build: buildRelease, |
|
20
|
publicId: ({ version }) => toPublicId(version), |
|
21
|
label: ({ version }) => version, |
|
22
|
preview: { |
|
23
|
reference: { |
|
24
|
url: "https://gh-release-images.s3.eu-north-1.amazonaws.com/v-2-13-0.jpg", |
|
25
|
input: { type: "release", version: "v2.13.0" }, |
|
26
|
}, |
|
27
|
// A short version and two longer ones — enough to see that the pill sizes |
|
28
|
// correctly around whatever the version string turns out to be. |
|
29
|
inputs: [ |
|
30
|
{ type: "release", version: "v2.9.0" }, |
|
31
|
{ type: "release", version: "v2.19.0" }, |
|
32
|
{ type: "release", version: "v2.100.0" }, |
|
33
|
], |
|
34
|
}, |
|
35
|
} |
|
36
|
|
|
37
|
export { RELEASE_SPEC, FILL_RESOLVES_AT } from "./spec.js" |
|
38
|
export type { PillSpec, ReleaseContentSpec, ReleaseSpec } from "./spec.js" |
|
39
|
export type { ReleaseInput } from "./template.js" |