From 74cdd685f23feba152465d79bf3065749581ae6f Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Mon, 6 Mar 2023 07:14:32 +0000 Subject: [PATCH] Made an interface that represents loader metadata --- src/loaders/loader-metadata.ts | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/loaders/loader-metadata.ts diff --git a/src/loaders/loader-metadata.ts b/src/loaders/loader-metadata.ts new file mode 100644 index 0000000..f79ccd7 --- /dev/null +++ b/src/loaders/loader-metadata.ts @@ -0,0 +1,55 @@ +import { Dependency } from "@/dependencies"; +import { PlatformType } from "@/platforms"; + +/** + * This interface standardizes the representation of metadata + * across various mod loaders (e.g. Fabric with "fabric.mod.json", Forge with + * "mods.toml", etc.). + * + * It offers a consistent way to access important mod information. + */ +export interface LoaderMetadata { + /** + * A unique identifier associated with the mod. + */ + get id(): string; + + /** + * The user-friendly name of the mod. + */ + get name(): string; + + /** + * The mod's version. + */ + get version(): string; + + /** + * A list of mod loaders that are compatible with this mod. + */ + get loaders(): string[]; + + /** + * The name of the game that the mod is created for. + */ + get gameName(): string; + + /** + * A list of game versions that the mod supports. + */ + get gameVersions(): string[]; + + /** + * A list of dependencies required by this mod. + */ + get dependencies(): Dependency[]; + + /** + * Retrieves the associated project ID for a specific platform. + * + * @param platform - The platform for which the project ID is needed. + * + * @returns The project ID corresponding to the provided platform. + */ + getProjectId(platform: PlatformType): string; +}