Externalize spec typings, use eslint.
Tslint is deprecated, as such we have moved to eslint. Linted the project with more stringent rules. The configuration will be changed as we figure out which rules we should keep.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
export interface ModsToml {
|
||||
|
||||
modLoader: string,
|
||||
modLoader: string
|
||||
loaderVersion: string
|
||||
issueTrackerURL?: string
|
||||
|
||||
@@ -19,9 +19,9 @@ export interface ModsToml {
|
||||
}>
|
||||
|
||||
dependencies?: {[modId: string]: {
|
||||
modId: string,
|
||||
mandatory: boolean,
|
||||
versionRange: string,
|
||||
modId: string
|
||||
mandatory: boolean
|
||||
versionRange: string
|
||||
ordering?: 'NONE' | 'BEFORE' | 'AFTER'
|
||||
side: 'BOTH' | 'CLIENT' | 'SERVER'
|
||||
}}
|
||||
|
||||
@@ -6,17 +6,17 @@ export interface VersionManifest113 {
|
||||
type: string
|
||||
mainClass: string
|
||||
inheritsFrom: string
|
||||
logging: any
|
||||
logging: {}
|
||||
arguments: {
|
||||
game: string[]
|
||||
}
|
||||
libraries: Array<{
|
||||
name: string,
|
||||
name: string
|
||||
downloads: {
|
||||
artifact: {
|
||||
path: string,
|
||||
url: string,
|
||||
sha1: string,
|
||||
path: string
|
||||
url: string
|
||||
sha1: string
|
||||
size: number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ export interface VersionManifest17 {
|
||||
mainClass: string
|
||||
inheritsFrom: string
|
||||
jar: string
|
||||
logging: any
|
||||
logging: {}
|
||||
libraries: Array<{
|
||||
name: string,
|
||||
url?: string,
|
||||
checksums?: string[],
|
||||
serverreq?: boolean,
|
||||
clientreq?: boolean,
|
||||
name: string
|
||||
url?: string
|
||||
checksums?: string[]
|
||||
serverreq?: boolean
|
||||
clientreq?: boolean
|
||||
comment?: string
|
||||
}>
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
export interface Artifact {
|
||||
|
||||
/**
|
||||
* The size of the artifact.
|
||||
*/
|
||||
size: number
|
||||
|
||||
/**
|
||||
* The MD5 hash of the artifact. This will be used to validate local artifacts.
|
||||
*/
|
||||
MD5: string
|
||||
|
||||
/**
|
||||
* The artifact's download url.
|
||||
*/
|
||||
url: string
|
||||
|
||||
/**
|
||||
* A relative path to where the file will be saved. This is appended to the base
|
||||
* path for the module's declared type.
|
||||
* If this is not specified, the path will be resolved based on the module's ID.
|
||||
*/
|
||||
path?: string
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import { Server } from './server'
|
||||
|
||||
export interface Distribution {
|
||||
|
||||
version: string
|
||||
|
||||
/**
|
||||
* Global settings for Discord Rich Presence.
|
||||
*/
|
||||
discord?: {
|
||||
/**
|
||||
* Client ID for the Application registered with Discord.
|
||||
*/
|
||||
clientId: string,
|
||||
/**
|
||||
* Tootltip for the smallImageKey.
|
||||
*/
|
||||
smallImageText: string,
|
||||
/**
|
||||
* Name of the uploaded image for the small profile artwork.
|
||||
*/
|
||||
smallImageKey: string
|
||||
}
|
||||
|
||||
/**
|
||||
* A URL to a RSS feed. Used for loading news.
|
||||
*/
|
||||
rss: string
|
||||
|
||||
/**
|
||||
* Array of server objects.
|
||||
*/
|
||||
servers: Server[]
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
import { Artifact } from './artifact'
|
||||
import { Required } from './required'
|
||||
import { Type } from './type'
|
||||
|
||||
export interface Module {
|
||||
|
||||
/**
|
||||
* The ID of the module. All modules that are not of type File MUST use a maven identifier.
|
||||
* Version information and other metadata is pulled from the identifier. Modules which are
|
||||
* stored maven style use the identifier to resolve the destination path. If the extension
|
||||
* is not provided, it defaults to jar.
|
||||
*
|
||||
* Template
|
||||
*
|
||||
* my.group:arifact:version@extension
|
||||
*
|
||||
* my/group/artifact/version/artifact-version.extension
|
||||
*
|
||||
* If the module's artifact does not declare the path property, its path will be resolved from the ID.
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The name of the module. Used on the UI.
|
||||
*/
|
||||
name: string
|
||||
|
||||
/**
|
||||
* The type of the module.
|
||||
*/
|
||||
type: Type
|
||||
|
||||
/**
|
||||
* Defines whether or not the module is required. If omitted, then the module will be required.
|
||||
*/
|
||||
required?: Required
|
||||
|
||||
/**
|
||||
* The download artifact for the module.
|
||||
*/
|
||||
artifact: Artifact
|
||||
|
||||
/**
|
||||
* An array of sub modules declared by this module. Typically, files which require other files
|
||||
* are declared as submodules. A quick example would be a mod, and the configuration file for
|
||||
* that mod. Submodules can also declare submodules of their own. The file is parsed recursively,
|
||||
* so there is no limit.
|
||||
*/
|
||||
subModules?: Module[]
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
export interface Required {
|
||||
|
||||
/**
|
||||
* If the module is required. Defaults to true if this property is omited.
|
||||
*/
|
||||
value?: boolean
|
||||
|
||||
/**
|
||||
* If the module is enabled by default. Has no effect unless Required.value
|
||||
* is false. Defaults to true if this property is omited.
|
||||
*/
|
||||
def?: boolean
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
import { Module } from './module'
|
||||
|
||||
export interface Server {
|
||||
|
||||
/**
|
||||
* The ID of the server. The launcher saves mod configurations and selected servers
|
||||
* by ID. If the ID changes, all data related to the old ID will be wiped.
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The name of the server. This is what users see on the UI.
|
||||
*/
|
||||
name: string
|
||||
|
||||
/**
|
||||
* A brief description of the server. Displayed on the UI to provide users more information.
|
||||
*/
|
||||
description: string
|
||||
|
||||
/**
|
||||
* A URL to the server's icon. Will be displayed on the UI.
|
||||
*/
|
||||
icon: string
|
||||
|
||||
/**
|
||||
* The version of the server configuration.
|
||||
*/
|
||||
version: string
|
||||
|
||||
/**
|
||||
* The server's IP address.
|
||||
*/
|
||||
address: string
|
||||
|
||||
/**
|
||||
* The version of minecraft that the server is running.
|
||||
*/
|
||||
minecraftVersion: string
|
||||
|
||||
/**
|
||||
* Server specific settings used for Discord Rich Presence.
|
||||
*/
|
||||
discord?: {
|
||||
/**
|
||||
* Short ID for the server. Displayed on the second status line as Server: shortId.
|
||||
*/
|
||||
shortId: string,
|
||||
/**
|
||||
* Ttooltip for the largeImageKey.
|
||||
*/
|
||||
largeImageText: string
|
||||
/**
|
||||
* Name of the uploaded image for the large profile artwork.
|
||||
*/
|
||||
largeImageKey: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Only one server in the array should have the mainServer property enabled. This
|
||||
* will tell the launcher that this is the default server to select if either the
|
||||
* previously selected server is invalid, or there is no previously selected server.
|
||||
* If this field is not defined by any server (avoid this), the first server will
|
||||
* be selected as the default. If multiple servers have mainServer enabled, the first
|
||||
* one the launcher finds will be the effective value. Servers which are not the default
|
||||
* may omit this property rather than explicitly setting it to false.
|
||||
*/
|
||||
mainServer?: boolean
|
||||
|
||||
/**
|
||||
* Whether or not the server can be autoconnected to. If false, the server will
|
||||
* not be autoconnected to even when the user has the autoconnect setting enabled.
|
||||
*/
|
||||
autoconnect: boolean
|
||||
|
||||
/**
|
||||
* An array of module objects.
|
||||
*/
|
||||
modules: Module[]
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
export enum Type {
|
||||
|
||||
Library = 'Library',
|
||||
ForgeHosted = 'ForgeHosted',
|
||||
Forge = 'Forge',
|
||||
LiteLoader = 'LiteLoader',
|
||||
ForgeMod = 'ForgeMod',
|
||||
LiteMod = 'LiteMod',
|
||||
File = 'File',
|
||||
VersionManifest = 'VersionManifest'
|
||||
|
||||
}
|
||||
|
||||
export interface TypeMetadata {
|
||||
|
||||
id: string
|
||||
defaultExtension?: string
|
||||
|
||||
}
|
||||
|
||||
export const TypeMetadata: {[property: string]: TypeMetadata} = {
|
||||
|
||||
Library: {
|
||||
id: Type.Library,
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
/**
|
||||
* @deprecated Will be replaced by Types.Forge.
|
||||
*/
|
||||
ForgeHosted: {
|
||||
id: Type.ForgeHosted,
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
Forge: {
|
||||
id: Type.Forge,
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
LiteLoader: {
|
||||
id: Type.LiteLoader,
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
ForgeMod: {
|
||||
id: Type.ForgeMod,
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
LiteMod: {
|
||||
id: Type.LiteMod,
|
||||
defaultExtension: 'litemod'
|
||||
},
|
||||
File: {
|
||||
id: Type.File
|
||||
},
|
||||
VersionManifest: {
|
||||
id: Type.VersionManifest,
|
||||
defaultExtension: 'json'
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ export abstract class BaseFileStructure implements FileStructure {
|
||||
this.containerDirectory = resolve(absoluteRoot, structRoot)
|
||||
}
|
||||
|
||||
public async init() {
|
||||
public async init(): Promise<void> {
|
||||
mkdirs(this.containerDirectory)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { mkdirs } from 'fs-extra'
|
||||
import { Distribution } from '../../spec/distribution'
|
||||
import { Distribution } from 'helios-distribution-types'
|
||||
import { ModelStructure } from './ModelStructure'
|
||||
import { ServerStructure } from './server.struct'
|
||||
|
||||
@@ -14,7 +14,7 @@ export class DistributionStructure implements ModelStructure<Distribution> {
|
||||
this.serverStruct = new ServerStructure(this.absoluteRoot, this.baseUrl)
|
||||
}
|
||||
|
||||
public async init() {
|
||||
public async init(): Promise<void> {
|
||||
await mkdirs(this.absoluteRoot)
|
||||
await this.serverStruct.init()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { Stats } from 'fs'
|
||||
import { Type } from 'helios-distribution-types'
|
||||
import { join } from 'path'
|
||||
import { resolve } from 'url'
|
||||
import { Type } from '../../../spec/type'
|
||||
import { ModuleStructure } from './module.struct'
|
||||
|
||||
export class MiscFileStructure extends ModuleStructure {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Stats } from 'fs-extra'
|
||||
import { Type } from 'helios-distribution-types'
|
||||
import { join } from 'path'
|
||||
import { resolve } from 'url'
|
||||
import { VersionSegmented } from '../../../../util/VersionSegmented'
|
||||
import { Type } from '../../../spec/type'
|
||||
import { ModuleStructure } from './module.struct'
|
||||
|
||||
export abstract class BaseForgeModStructure extends ModuleStructure implements VersionSegmented {
|
||||
@@ -17,9 +17,11 @@ export abstract class BaseForgeModStructure extends ModuleStructure implements V
|
||||
|
||||
public abstract isForVersion(version: string): boolean
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
|
||||
return resolve(this.baseUrl, join(this.relativeRoot, name))
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
protected async getModulePath(name: string, path: string, stats: Stats): Promise<string | null> {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export class ForgeModStructure113 extends BaseForgeModStructure {
|
||||
|
||||
public static readonly IMPLEMENTATION_VERSION_REGEX = /^Implementation-Version: (.+)[\r\n]/
|
||||
|
||||
public static isForVersion(version: string) {
|
||||
public static isForVersion(version: string): boolean {
|
||||
return VersionUtil.isVersionAcceptable(version, [13, 14, 15])
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ export class ForgeModStructure113 extends BaseForgeModStructure {
|
||||
}
|
||||
|
||||
private getForgeModMetadata(buf: Buffer, name: string): ModsToml {
|
||||
|
||||
if (!this.forgeModMetadata.hasOwnProperty(name)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.forgeModMetadata, name)) {
|
||||
const zip = new AdmZip(buf)
|
||||
const zipEntries = zip.getEntries()
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { BaseForgeModStructure } from '../forgemod.struct'
|
||||
|
||||
export class ForgeModStructure17 extends BaseForgeModStructure {
|
||||
|
||||
public static isForVersion(version: string) {
|
||||
public static isForVersion(version: string): boolean {
|
||||
return VersionUtil.isVersionAcceptable(version, [7, 8, 9, 10, 11, 12])
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ForgeModStructure17 extends BaseForgeModStructure {
|
||||
}
|
||||
|
||||
private getForgeModMetadata(buf: Buffer, name: string): McModInfo {
|
||||
if (!this.forgeModMetadata.hasOwnProperty(name)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.forgeModMetadata, name)) {
|
||||
const zip = new AdmZip(buf)
|
||||
const zipEntries = zip.getEntries()
|
||||
|
||||
@@ -79,7 +79,7 @@ export class ForgeModStructure17 extends BaseForgeModStructure {
|
||||
// Assuming the main mod will be the first entry in this file.
|
||||
try {
|
||||
const resolved = JSON.parse(raw) as object
|
||||
if (resolved.hasOwnProperty('modListVersion')) {
|
||||
if (Object.prototype.hasOwnProperty.call(resolved, 'modListVersion')) {
|
||||
this.forgeModMetadata[name] = (resolved as McModInfoList).modList[0]
|
||||
} else {
|
||||
this.forgeModMetadata[name] = (resolved as McModInfo[])[0]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import AdmZip from 'adm-zip'
|
||||
import { Stats } from 'fs-extra'
|
||||
import { Type } from 'helios-distribution-types'
|
||||
import { join } from 'path'
|
||||
import { resolve } from 'url'
|
||||
import { capitalize } from '../../../../util/stringutils'
|
||||
import { LiteMod } from '../../../liteloader/litemod'
|
||||
import { Type } from '../../../spec/type'
|
||||
import { ModuleStructure } from './module.struct'
|
||||
|
||||
export class LiteModStructure extends ModuleStructure {
|
||||
@@ -26,15 +26,17 @@ export class LiteModStructure extends ModuleStructure {
|
||||
protected async getModuleName(name: string, path: string, stats: Stats, buf: Buffer): Promise<string> {
|
||||
return capitalize(this.getLiteModMetadata(buf, name).name)
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
|
||||
return resolve(this.baseUrl, join(this.relativeRoot, name))
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
protected async getModulePath(name: string, path: string, stats: Stats): Promise<string | null> {
|
||||
return null
|
||||
}
|
||||
|
||||
private getLiteModMetadata(buf: Buffer, name: string): LiteMod {
|
||||
if (!this.liteModMetadata.hasOwnProperty(name)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.liteModMetadata, name)) {
|
||||
const zip = new AdmZip(buf)
|
||||
const zipEntries = zip.getEntries()
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { createHash } from 'crypto'
|
||||
import { lstat, pathExists, readdir, readFile, Stats } from 'fs-extra'
|
||||
import { Module, Type, TypeMetadata } from 'helios-distribution-types'
|
||||
import { resolve } from 'path'
|
||||
import { Module } from '../../../spec/module'
|
||||
import { Type, TypeMetadata } from '../../../spec/type'
|
||||
import { BaseModelStructure } from '../basemodel.struct'
|
||||
|
||||
export abstract class ModuleStructure extends BaseModelStructure<Module> {
|
||||
@@ -25,7 +24,7 @@ export abstract class ModuleStructure extends BaseModelStructure<Module> {
|
||||
return this.resolvedModels
|
||||
}
|
||||
|
||||
protected generateMavenIdentifier(name: string, version: string) {
|
||||
protected generateMavenIdentifier(name: string, version: string): string {
|
||||
return `generated.${this.type.toLowerCase()}:${name}:${version}@${TypeMetadata[this.type].defaultExtension}`
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { lstat, mkdirs, pathExists, readdir, readFile, writeFile } from 'fs-extra'
|
||||
import { Server } from 'helios-distribution-types'
|
||||
import { dirname, join, resolve as resolvePath } from 'path'
|
||||
import { resolve as resolveUrl } from 'url'
|
||||
import { VersionSegmentedRegistry } from '../../../util/VersionSegmentedRegistry'
|
||||
import { ServerMeta } from '../../nebula/servermeta'
|
||||
import { Server } from '../../spec/server'
|
||||
import { BaseModelStructure } from './basemodel.struct'
|
||||
import { MiscFileStructure } from './module/file.struct'
|
||||
import { LiteModStructure } from './module/litemod.struct'
|
||||
@@ -19,7 +19,7 @@ export class ServerStructure extends BaseModelStructure<Server> {
|
||||
super(absoluteRoot, '', 'servers', baseUrl)
|
||||
}
|
||||
|
||||
public async getSpecModel() {
|
||||
public async getSpecModel(): Promise<Server[]> {
|
||||
if (this.resolvedModels == null) {
|
||||
this.resolvedModels = await this._doSeverRetrieval()
|
||||
}
|
||||
@@ -33,7 +33,7 @@ export class ServerStructure extends BaseModelStructure<Server> {
|
||||
forgeVersion?: string
|
||||
liteloaderVersion?: string
|
||||
}
|
||||
) {
|
||||
): Promise<void> {
|
||||
const effectiveId = `${id}-${minecraftVersion}`
|
||||
const absoluteServerRoot = resolvePath(this.containerDirectory, effectiveId)
|
||||
const relativeServerRoot = join(this.relativeRoot, effectiveId)
|
||||
@@ -81,7 +81,7 @@ export class ServerStructure extends BaseModelStructure<Server> {
|
||||
const match = this.ID_REGEX.exec(file)
|
||||
if (match == null) {
|
||||
console.warn(`Server directory ${file} does not match the defined standard.`)
|
||||
console.warn(`All server ids must end with -<minecraft version> (ex. -1.12.2)`)
|
||||
console.warn('All server ids must end with -<minecraft version> (ex. -1.12.2)')
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -15,38 +15,40 @@ export abstract class BaseMavenRepo extends BaseFileStructure {
|
||||
super(absoluteRoot, relativeRoot, structRoot)
|
||||
}
|
||||
|
||||
public getArtifactById(mavenIdentifier: string, extension?: string): string | null {
|
||||
const resolved = MavenUtil.mavenIdentifierToString(mavenIdentifier, extension)
|
||||
return resolved == null ? null : resolve(this.containerDirectory, resolved)
|
||||
public getArtifactById(mavenIdentifier: string, extension?: string): string {
|
||||
return resolve(this.containerDirectory, MavenUtil.mavenIdentifierToString(mavenIdentifier, extension))
|
||||
}
|
||||
|
||||
public getArtifactByComponents(group: string, artifact: string, version: string,
|
||||
classifier?: string, extension = 'jar'): string {
|
||||
public getArtifactByComponents(
|
||||
group: string, artifact: string, version: string, classifier?: string, extension = 'jar'
|
||||
): string {
|
||||
return resolve(this.containerDirectory,
|
||||
MavenUtil.mavenComponentsToString(group, artifact, version, classifier, extension))
|
||||
}
|
||||
|
||||
public getArtifactUrlByComponents(baseURL: string, group: string, artifact: string, version: string,
|
||||
classifier?: string, extension = 'jar'): string {
|
||||
public getArtifactUrlByComponents(
|
||||
baseURL: string, group: string, artifact: string, version: string, classifier?: string, extension = 'jar'
|
||||
): string {
|
||||
return resolveURL(baseURL, join(this.relativeRoot,
|
||||
MavenUtil.mavenComponentsToString(group, artifact, version, classifier, extension)))
|
||||
}
|
||||
|
||||
public async artifactExists(path: string) {
|
||||
public async artifactExists(path: string): Promise<boolean> {
|
||||
return pathExists(path)
|
||||
}
|
||||
|
||||
public async downloadArtifactById(url: string, mavenIdentifier: string, extension?: string) {
|
||||
public async downloadArtifactById(url: string, mavenIdentifier: string, extension?: string): Promise<void> {
|
||||
return this.downloadArtifactBase(url, MavenUtil.mavenIdentifierToString(mavenIdentifier, extension) as string)
|
||||
}
|
||||
|
||||
public async downloadArtifactByComponents(url: string, group: string, artifact: string, version: string,
|
||||
classifier?: string, extension?: string) {
|
||||
public async downloadArtifactByComponents(
|
||||
url: string, group: string, artifact: string, version: string, classifier?: string, extension?: string
|
||||
): Promise<void> {
|
||||
return this.downloadArtifactBase(url,
|
||||
MavenUtil.mavenComponentsToString(group, artifact, version, classifier, extension))
|
||||
}
|
||||
|
||||
private async downloadArtifactBase(url: string, relative: string) {
|
||||
private async downloadArtifactBase(url: string, relative: string): Promise<void> {
|
||||
const resolvedURL = resolveURL(url, relative).toString()
|
||||
console.debug(`Downloading ${resolvedURL}..`)
|
||||
const response = await axios({
|
||||
|
||||
@@ -18,14 +18,14 @@ export class LibRepoStructure extends BaseMavenRepo {
|
||||
super(absoluteRoot, relativeRoot, 'lib')
|
||||
}
|
||||
|
||||
public getLocalForge(version: string, classifier?: string) {
|
||||
public getLocalForge(version: string, classifier?: string): string {
|
||||
return this.getArtifactByComponents(
|
||||
LibRepoStructure.FORGE_GROUP,
|
||||
LibRepoStructure.FORGE_ARTIFACT,
|
||||
version, classifier, 'jar')
|
||||
}
|
||||
|
||||
public getLocalLiteLoader(version: string, classifier?: string) {
|
||||
public getLocalLiteLoader(version: string, classifier?: string): string {
|
||||
return this.getArtifactByComponents(
|
||||
LibRepoStructure.LITELOADER_GROUP,
|
||||
LibRepoStructure.LITELOADER_ARTIFACT,
|
||||
|
||||
@@ -17,25 +17,25 @@ export class RepoStructure extends BaseFileStructure {
|
||||
this.versionRepoStruct = new VersionRepoStructure(this.containerDirectory, this.relativeRoot)
|
||||
}
|
||||
|
||||
public async init() {
|
||||
public async init(): Promise<void> {
|
||||
super.init()
|
||||
await this.libRepoStruct.init()
|
||||
await this.versionRepoStruct.init()
|
||||
}
|
||||
|
||||
public getLibRepoStruct() {
|
||||
public getLibRepoStruct(): LibRepoStructure {
|
||||
return this.libRepoStruct
|
||||
}
|
||||
|
||||
public getVersionRepoStruct() {
|
||||
public getVersionRepoStruct(): VersionRepoStructure {
|
||||
return this.versionRepoStruct
|
||||
}
|
||||
|
||||
public getTempDirectory() {
|
||||
public getTempDirectory(): string {
|
||||
return join(this.absoluteRoot, 'temp')
|
||||
}
|
||||
|
||||
public getWorkDirectory() {
|
||||
public getWorkDirectory(): string {
|
||||
return join(this.absoluteRoot, 'work')
|
||||
}
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@ export class VersionRepoStructure extends BaseFileStructure {
|
||||
super(absoluteRoot, relativeRoot, 'versions')
|
||||
}
|
||||
|
||||
public getFileName(minecraftVersion: string, forgeVersion: string) {
|
||||
public getFileName(minecraftVersion: string, forgeVersion: string): string {
|
||||
return `${minecraftVersion}-forge-${forgeVersion}`
|
||||
}
|
||||
|
||||
public getVersionManifest(minecraftVersion: string, forgeVersion: string) {
|
||||
public getVersionManifest(minecraftVersion: string, forgeVersion: string): string {
|
||||
const fileName = this.getFileName(minecraftVersion, forgeVersion)
|
||||
return join(this.containerDirectory, fileName, `${fileName}.json`)
|
||||
}
|
||||
|
||||
public getVersionManifestURL(url: string, minecraftVersion: string, forgeVersion: string) {
|
||||
public getVersionManifestURL(url: string, minecraftVersion: string, forgeVersion: string): string {
|
||||
const fileName = this.getFileName(minecraftVersion, forgeVersion)
|
||||
return resolveURL(url, join(this.relativeRoot, fileName, `${fileName}.json`))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user