diff --git a/src/metadata/dependency.ts b/src/metadata/dependency.ts new file mode 100644 index 0000000..d0ed2a5 --- /dev/null +++ b/src/metadata/dependency.ts @@ -0,0 +1,25 @@ +import PublisherTarget from "../publishing/publisher-target"; +import DependencyKind from "./dependency-kind"; + +interface Dependency { + get id(): string; + get version(): string; + get kind(): DependencyKind; + get ignore(): boolean; + + getProjectSlug(project: PublisherTarget): string; +} + +namespace Dependency { + export function create({ id, version = "*", kind = DependencyKind.Depends, ignore = false }: { id: string, version?: string, kind?: DependencyKind, ignore?: boolean }): Dependency { + return { + id, + version: version ?? "*", + kind: kind ?? DependencyKind.Depends, + ignore: ignore ?? false, + getProjectSlug: _ => id + }; + } +} + +export default Dependency;