Co-authored-by: Manuel <30572287+manuel-rw@users.noreply.github.com> Co-authored-by: Andre Silva <asilva01@acuitysso.com> Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { IconRocket } from "@tabler/icons-react";
|
|
import { z } from "zod";
|
|
|
|
import { createWidgetDefinition } from "../definition";
|
|
import { optionsBuilder } from "../options";
|
|
|
|
const relativeDateSchema = z
|
|
.string()
|
|
.regex(/^\d+[hdwmyHDWMY]$/)
|
|
.or(z.literal(""));
|
|
|
|
export const { definition, componentLoader } = createWidgetDefinition("releases", {
|
|
icon: IconRocket,
|
|
createOptions() {
|
|
return optionsBuilder.from((factory) => ({
|
|
newReleaseWithin: factory.text({
|
|
defaultValue: "1w",
|
|
withDescription: true,
|
|
validate: relativeDateSchema,
|
|
}),
|
|
staleReleaseWithin: factory.text({
|
|
defaultValue: "6M",
|
|
withDescription: true,
|
|
validate: relativeDateSchema,
|
|
}),
|
|
showOnlyHighlighted: factory.switch({
|
|
withDescription: true,
|
|
defaultValue: true,
|
|
}),
|
|
showDetails: factory.switch({
|
|
defaultValue: true,
|
|
}),
|
|
repositories: factory.multiReleasesRepositories({
|
|
defaultValue: [],
|
|
validate: z.array(
|
|
z.object({
|
|
providerKey: z.string().min(1),
|
|
identifier: z.string().min(1),
|
|
versionFilter: z
|
|
.object({
|
|
prefix: z.string().optional(),
|
|
precision: z.number(),
|
|
suffix: z.string().optional(),
|
|
})
|
|
.optional(),
|
|
iconUrl: z.string().url().optional(),
|
|
}),
|
|
),
|
|
}),
|
|
}));
|
|
},
|
|
}).withDynamicImport(() => import("./component"));
|