mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-12-28 17:44:54 -05:00
Removed deprecated metadata-related classes
This commit is contained in:
parent
b7fa4fab67
commit
de4393cceb
2 changed files with 0 additions and 73 deletions
|
@ -1,41 +0,0 @@
|
|||
import action from "../../package.json";
|
||||
import Dependency from "./dependency";
|
||||
import DependencyKind from "./dependency-kind";
|
||||
import PublisherTarget from "../publishing/publisher-target";
|
||||
|
||||
interface DependencyOptions {
|
||||
id: string;
|
||||
version?: string;
|
||||
kind?: DependencyKind;
|
||||
ignore?: boolean;
|
||||
}
|
||||
|
||||
export default class ModConfigDependency<TMetadata extends DependencyOptions = Record<string, unknown> & DependencyOptions> implements Dependency {
|
||||
public readonly id: string;
|
||||
public readonly version: string;
|
||||
public readonly kind: DependencyKind;
|
||||
public readonly ignore: boolean;
|
||||
protected readonly metadata: TMetadata;
|
||||
|
||||
constructor(metadata: TMetadata) {
|
||||
this.id = String(metadata.id ?? "");
|
||||
this.version = String(metadata.version ?? "*");
|
||||
this.kind = metadata.kind || DependencyKind.Depends;
|
||||
this.metadata = metadata;
|
||||
this.ignore = this.metadata["custom"]?.[action.name]?.ignore ?? this.metadata[action.name]?.ignore ?? this.metadata.ignore ?? false;
|
||||
}
|
||||
|
||||
getProjectSlug(project: PublisherTarget): string {
|
||||
const projectName = PublisherTarget.toString(project).toLowerCase();
|
||||
const metadata = this.metadata;
|
||||
const custom = metadata["custom"];
|
||||
const projects = metadata["projects"];
|
||||
return String(
|
||||
metadata[action.name]?.[projectName]?.slug ?? metadata[action.name]?.[projectName] ??
|
||||
custom?.[action.name]?.[projectName]?.slug ?? custom?.[action.name]?.[projectName] ??
|
||||
projects?.[projectName]?.slug ?? projects?.[projectName] ??
|
||||
custom?.projects?.[projectName]?.slug ?? custom?.projects?.[projectName] ??
|
||||
this.id
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
import action from "../../package.json";
|
||||
import Dependency from "./dependency";
|
||||
import ModMetadata from "./mod-metadata";
|
||||
import PublisherTarget from "../publishing/publisher-target";
|
||||
|
||||
export default abstract class ModConfig<TConfig = Record<string, unknown>> implements ModMetadata {
|
||||
public abstract get id(): string;
|
||||
public abstract get name(): string;
|
||||
public abstract get version(): string;
|
||||
public abstract get loaders(): string[];
|
||||
public abstract get dependencies(): Dependency[];
|
||||
|
||||
protected readonly config: TConfig;
|
||||
|
||||
constructor(config: TConfig) {
|
||||
this.config = config || <TConfig>{};
|
||||
}
|
||||
|
||||
getProjectId(project: PublisherTarget): string | undefined {
|
||||
const projectName = PublisherTarget.toString(project).toLowerCase();
|
||||
const config = this.config;
|
||||
const custom = config["custom"];
|
||||
const projects = config["projects"];
|
||||
const projectId = (
|
||||
config[action.name]?.[projectName]?.id ?? config[action.name]?.[projectName] ??
|
||||
custom?.[action.name]?.[projectName]?.id ?? custom?.[action.name]?.[projectName] ??
|
||||
projects?.[projectName]?.id ?? projects?.[projectName] ??
|
||||
custom?.projects?.[projectName]?.id ?? custom?.projects?.[projectName]
|
||||
);
|
||||
return projectId === undefined ? projectId : String(projectId);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue