Drop support for LiteLoader.
Liteloader is obsolete and abandoned. It is not worth the hassle of maintenance.
This commit is contained in:
11
README.md
11
README.md
@@ -103,7 +103,7 @@ __*SubCommands*__
|
|||||||
|
|
||||||
#### Generate Server
|
#### Generate Server
|
||||||
|
|
||||||
Generate an new server in the root directory. Options are provided to include forge/liteloader in the generated server.
|
Generate an new server in the root directory. Options are provided to include forge in the generated server.
|
||||||
|
|
||||||
`generate server <id> <version> <options>`
|
`generate server <id> <version> <options>`
|
||||||
|
|
||||||
@@ -113,9 +113,6 @@ Options:
|
|||||||
* OPTIONAL (default: null)
|
* OPTIONAL (default: null)
|
||||||
* If not provided forge will not be enabled.
|
* If not provided forge will not be enabled.
|
||||||
* You can provide either `latest` or `recommended` to use the latest/recommended version of forge.
|
* You can provide either `latest` or `recommended` to use the latest/recommended version of forge.
|
||||||
* `--liteloader <string>` Specify liteloader version.
|
|
||||||
* OPTIONAL (default: null)
|
|
||||||
* If not provided liteloader will not be enabled.
|
|
||||||
|
|
||||||
>
|
>
|
||||||
> Example Usage
|
> Example Usage
|
||||||
@@ -215,8 +212,6 @@ Ex.
|
|||||||
* `libraries` All modules of type `Library`
|
* `libraries` All modules of type `Library`
|
||||||
* `forgemods` All modules of type `ForgeMod`.
|
* `forgemods` All modules of type `ForgeMod`.
|
||||||
* This is a directory of toggleable modules. See the note below.
|
* This is a directory of toggleable modules. See the note below.
|
||||||
* `litemods` All modules of type `LiteMod`.
|
|
||||||
* This is a directory of toggleable modules. See the note below.
|
|
||||||
* `TestServer-1.12.2.png` Server icon file.
|
* `TestServer-1.12.2.png` Server icon file.
|
||||||
|
|
||||||
#### Toggleable Modules
|
#### Toggleable Modules
|
||||||
@@ -315,7 +310,7 @@ In the above example, all files of type `cfg` in the config directory will be un
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"appliesTo": ["forgemods", "litemods"],
|
"appliesTo": ["forgemods"],
|
||||||
"patterns": [
|
"patterns": [
|
||||||
"optionalon/*.jar"
|
"optionalon/*.jar"
|
||||||
]
|
]
|
||||||
@@ -324,7 +319,7 @@ In the above example, all files of type `cfg` in the config directory will be un
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Another example where all `optionalon` forgemods and litemods are untracked. **Untracking mods is NOT recommended. This is an example ONLY.**
|
Another example where all `optionalon` forgemods are untracked. **Untracking mods is NOT recommended. This is an example ONLY.**
|
||||||
|
|
||||||
### Note on JSON Schemas
|
### Note on JSON Schemas
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
11
src/index.ts
11
src/index.ts
@@ -174,19 +174,13 @@ const generateServerCommand: yargs.CommandModule = {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
default: null
|
default: null
|
||||||
})
|
})
|
||||||
.option('liteloader', {
|
|
||||||
describe: 'LiteLoader version.',
|
|
||||||
type: 'string',
|
|
||||||
default: null
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
handler: async (argv) => {
|
handler: async (argv) => {
|
||||||
argv.root = getRoot()
|
argv.root = getRoot()
|
||||||
|
|
||||||
logger.debug(`Root set to ${argv.root}`)
|
logger.debug(`Root set to ${argv.root}`)
|
||||||
logger.debug(`Generating server ${argv.id} for Minecraft ${argv.version}.`,
|
logger.debug(`Generating server ${argv.id} for Minecraft ${argv.version}.`,
|
||||||
`\n\t├ Forge version: ${argv.forge}`,
|
`\n\t└ Forge version: ${argv.forge}`)
|
||||||
`\n\t└ LiteLoader version: ${argv.liteloader}`)
|
|
||||||
|
|
||||||
const minecraftVersion = new MinecraftVersion(argv.version as string)
|
const minecraftVersion = new MinecraftVersion(argv.version as string)
|
||||||
|
|
||||||
@@ -204,8 +198,7 @@ const generateServerCommand: yargs.CommandModule = {
|
|||||||
argv.id as string,
|
argv.id as string,
|
||||||
minecraftVersion,
|
minecraftVersion,
|
||||||
{
|
{
|
||||||
forgeVersion: argv.forge as string,
|
forgeVersion: argv.forge as string
|
||||||
liteloaderVersion: argv.liteloader as string
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
export enum LibraryType {
|
export enum LibraryType {
|
||||||
|
|
||||||
FORGE = 'FORGE',
|
FORGE = 'FORGE'
|
||||||
LITELOADER = 'LITELOADER'
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
export interface LiteMod {
|
|
||||||
|
|
||||||
name: string
|
|
||||||
version: string
|
|
||||||
mcversion: string
|
|
||||||
revision: string
|
|
||||||
description: string
|
|
||||||
author?: string
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ export interface UntrackedFilesOption {
|
|||||||
|
|
||||||
export interface ServerMetaOptions {
|
export interface ServerMetaOptions {
|
||||||
forgeVersion?: string
|
forgeVersion?: string
|
||||||
liteloaderVersion?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDefaultServerMeta(id: string, version: string, options?: ServerMetaOptions): ServerMeta {
|
export function getDefaultServerMeta(id: string, version: string, options?: ServerMetaOptions): ServerMeta {
|
||||||
@@ -42,13 +41,6 @@ export function getDefaultServerMeta(id: string, version: string, options?: Serv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(options?.liteloaderVersion) {
|
|
||||||
servMeta.meta.description = `${servMeta.meta.description} (Liteloader v${options.liteloaderVersion})`
|
|
||||||
servMeta.liteloader = {
|
|
||||||
version: options.liteloaderVersion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add empty untracked files.
|
// Add empty untracked files.
|
||||||
servMeta.untrackedFiles = []
|
servMeta.untrackedFiles = []
|
||||||
|
|
||||||
@@ -81,16 +73,6 @@ export interface ServerMeta {
|
|||||||
version: string
|
version: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Properties related to liteloader.
|
|
||||||
*/
|
|
||||||
liteloader?: {
|
|
||||||
/**
|
|
||||||
* The liteloader version.
|
|
||||||
*/
|
|
||||||
version: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of option objects defining patterns for untracked files.
|
* A list of option objects defining patterns for untracked files.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ export class LibRepoStructure extends BaseMavenRepo {
|
|||||||
public static readonly FORGE_GROUP = 'net.minecraftforge'
|
public static readonly FORGE_GROUP = 'net.minecraftforge'
|
||||||
public static readonly FORGE_ARTIFACT = 'forge'
|
public static readonly FORGE_ARTIFACT = 'forge'
|
||||||
|
|
||||||
public static readonly LITELOADER_GROUP = 'com.mumfrey'
|
|
||||||
public static readonly LITELOADER_ARTIFACT = 'liteloader'
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
absoluteRoot: string,
|
absoluteRoot: string,
|
||||||
relativeRoot: string
|
relativeRoot: string
|
||||||
@@ -29,11 +26,4 @@ export class LibRepoStructure extends BaseMavenRepo {
|
|||||||
version, classifier, 'jar')
|
version, classifier, 'jar')
|
||||||
}
|
}
|
||||||
|
|
||||||
public getLocalLiteLoader(version: string, classifier?: string): string {
|
|
||||||
return this.getArtifactByComponents(
|
|
||||||
LibRepoStructure.LITELOADER_GROUP,
|
|
||||||
LibRepoStructure.LITELOADER_ARTIFACT,
|
|
||||||
version, classifier, 'jar')
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { VersionSegmentedRegistry } from '../../util/VersionSegmentedRegistry'
|
|||||||
import { ServerMeta, getDefaultServerMeta, ServerMetaOptions, UntrackedFilesOption } from '../../model/nebula/servermeta'
|
import { ServerMeta, getDefaultServerMeta, ServerMetaOptions, UntrackedFilesOption } from '../../model/nebula/servermeta'
|
||||||
import { BaseModelStructure } from './BaseModel.struct'
|
import { BaseModelStructure } from './BaseModel.struct'
|
||||||
import { MiscFileStructure } from './module/File.struct'
|
import { MiscFileStructure } from './module/File.struct'
|
||||||
import { LiteModStructure } from './module/LiteMod.struct'
|
|
||||||
import { LibraryStructure } from './module/Library.struct'
|
import { LibraryStructure } from './module/Library.struct'
|
||||||
import { MinecraftVersion } from '../../util/MinecraftVersion'
|
import { MinecraftVersion } from '../../util/MinecraftVersion'
|
||||||
import { addSchemaToObject, SchemaTypes } from '../../util/SchemaUtil'
|
import { addSchemaToObject, SchemaTypes } from '../../util/SchemaUtil'
|
||||||
@@ -41,7 +40,6 @@ export class ServerStructure extends BaseModelStructure<Server> {
|
|||||||
minecraftVersion: MinecraftVersion,
|
minecraftVersion: MinecraftVersion,
|
||||||
options: {
|
options: {
|
||||||
forgeVersion?: string
|
forgeVersion?: string
|
||||||
liteloaderVersion?: string
|
|
||||||
}
|
}
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const effectiveId = `${id}-${minecraftVersion}`
|
const effectiveId = `${id}-${minecraftVersion}`
|
||||||
@@ -70,12 +68,6 @@ export class ServerStructure extends BaseModelStructure<Server> {
|
|||||||
serverMetaOpts.forgeVersion = options.forgeVersion
|
serverMetaOpts.forgeVersion = options.forgeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.liteloaderVersion != null) {
|
|
||||||
const lms = new LiteModStructure(absoluteServerRoot, relativeServerRoot, this.baseUrl, minecraftVersion, [])
|
|
||||||
await lms.init()
|
|
||||||
serverMetaOpts.liteloaderVersion = options.liteloaderVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
const serverMeta: ServerMeta = addSchemaToObject(
|
const serverMeta: ServerMeta = addSchemaToObject(
|
||||||
getDefaultServerMeta(id, minecraftVersion.toString(), serverMetaOpts),
|
getDefaultServerMeta(id, minecraftVersion.toString(), serverMetaOpts),
|
||||||
SchemaTypes.ServerMetaSchema,
|
SchemaTypes.ServerMetaSchema,
|
||||||
@@ -159,13 +151,6 @@ export class ServerStructure extends BaseModelStructure<Server> {
|
|||||||
modules.push(...forgeModModules)
|
modules.push(...forgeModModules)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(serverMeta.liteloader) {
|
|
||||||
const liteModStruct = new LiteModStructure(absoluteServerRoot, relativeServerRoot, this.baseUrl, minecraftVersion, untrackedFiles)
|
|
||||||
const liteModModules = await liteModStruct.getSpecModel()
|
|
||||||
modules.push(...liteModModules)
|
|
||||||
}
|
|
||||||
|
|
||||||
const libraryStruct = new LibraryStructure(absoluteServerRoot, relativeServerRoot, this.baseUrl, minecraftVersion, untrackedFiles)
|
const libraryStruct = new LibraryStructure(absoluteServerRoot, relativeServerRoot, this.baseUrl, minecraftVersion, untrackedFiles)
|
||||||
const libraryModules = await libraryStruct.getSpecModel()
|
const libraryModules = await libraryStruct.getSpecModel()
|
||||||
modules.push(...libraryModules)
|
modules.push(...libraryModules)
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
import StreamZip from 'node-stream-zip'
|
|
||||||
import { Stats } from 'fs-extra'
|
|
||||||
import { Type } from 'helios-distribution-types'
|
|
||||||
import { join } from 'path'
|
|
||||||
import { URL } from 'url'
|
|
||||||
import { capitalize } from '../../../util/stringutils'
|
|
||||||
import { LiteMod } from '../../../model/liteloader/litemod'
|
|
||||||
import { ToggleableModuleStructure } from './ToggleableModule.struct'
|
|
||||||
import { MinecraftVersion } from '../../../util/MinecraftVersion'
|
|
||||||
import { LibraryType } from '../../../model/claritas/ClaritasLibraryType'
|
|
||||||
import { MetadataUtil } from '../../../util/MetadataUtil'
|
|
||||||
import { UntrackedFilesOption } from '../../../model/nebula/servermeta'
|
|
||||||
|
|
||||||
export class LiteModStructure extends ToggleableModuleStructure {
|
|
||||||
|
|
||||||
private liteModMetadata: {[property: string]: LiteMod | undefined} = {}
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
absoluteRoot: string,
|
|
||||||
relativeRoot: string,
|
|
||||||
baseUrl: string,
|
|
||||||
minecraftVersion: MinecraftVersion,
|
|
||||||
untrackedFiles: UntrackedFilesOption[]
|
|
||||||
) {
|
|
||||||
super(absoluteRoot, relativeRoot, 'litemods', baseUrl, minecraftVersion, Type.LiteMod, untrackedFiles)
|
|
||||||
}
|
|
||||||
|
|
||||||
public getLoggerName(): string {
|
|
||||||
return 'LiteModStructure'
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async getModuleId(name: string, path: string): Promise<string> {
|
|
||||||
const liteModData = await this.getLiteModMetadata(name, path)
|
|
||||||
return this.generateMavenIdentifier(
|
|
||||||
MetadataUtil.completeGroupInference(this.getClaritasGroup(path), liteModData.name), liteModData.name, `${liteModData.version}-${liteModData.mcversion}`)
|
|
||||||
}
|
|
||||||
protected async getModuleName(name: string, path: string): Promise<string> {
|
|
||||||
return capitalize((await this.getLiteModMetadata(name, path)).name)
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
|
|
||||||
return new URL(join(this.relativeRoot, this.getActiveNamespace(), name), this.baseUrl).toString()
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
protected async getModulePath(name: string, path: string, stats: Stats): Promise<string | null> {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
protected getClaritasType(): LibraryType {
|
|
||||||
return LibraryType.LITELOADER
|
|
||||||
}
|
|
||||||
|
|
||||||
private getLiteModMetadata(name: string, path: string): Promise<LiteMod> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (!Object.prototype.hasOwnProperty.call(this.liteModMetadata, name)) {
|
|
||||||
|
|
||||||
const zip = new StreamZip({
|
|
||||||
file: path,
|
|
||||||
storeEntries: true
|
|
||||||
})
|
|
||||||
|
|
||||||
zip.on('error', err => reject(err))
|
|
||||||
zip.on('ready', () => {
|
|
||||||
try {
|
|
||||||
const res = this.processZip(zip, name)
|
|
||||||
zip.close()
|
|
||||||
resolve(res)
|
|
||||||
return
|
|
||||||
} catch(err) {
|
|
||||||
zip.close()
|
|
||||||
reject(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
} else {
|
|
||||||
resolve(this.liteModMetadata[name] as LiteMod)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private processZip(zip: StreamZip, name: string): LiteMod {
|
|
||||||
|
|
||||||
let raw: Buffer | undefined
|
|
||||||
try {
|
|
||||||
raw = zip.entryDataSync('litemod.json')
|
|
||||||
} catch(err) {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
if (raw) {
|
|
||||||
this.liteModMetadata[name] = JSON.parse(raw.toString()) as LiteMod
|
|
||||||
} else {
|
|
||||||
throw new Error(`Litemod ${name} does not contain litemod.json file.`)
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.liteModMetadata[name] as LiteMod
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user