mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-21 16:00:59 -05:00
Fixed default value resolution in ModrinthUploader
This commit is contained in:
parent
98e9aced20
commit
4cf81648dc
2 changed files with 14 additions and 11 deletions
|
@ -51,7 +51,7 @@ export class ModrinthUploader extends GenericPlatformUploader<ModrinthUploaderOp
|
|||
*/
|
||||
protected async uploadCore(request: ModrinthUploadRequest): Promise<ModrinthUploadReport> {
|
||||
const api = new ModrinthApiClient({ token: request.token.unwrap() });
|
||||
const unfeatureMode = request.unfeatureMode ?? request.featured ? ModrinthUnfeatureMode.SUBSET : ModrinthUnfeatureMode.NONE;
|
||||
const unfeatureMode = request.unfeatureMode ?? (request.featured ? ModrinthUnfeatureMode.SUBSET : ModrinthUnfeatureMode.NONE);
|
||||
|
||||
const project = await this.getProject(request.id, api);
|
||||
const version = await this.createVersion(request, project, api);
|
||||
|
@ -97,15 +97,16 @@ export class ModrinthUploader extends GenericPlatformUploader<ModrinthUploaderOp
|
|||
const dependencies = await this.convertToModrinthDependencies(request.dependencies, api);
|
||||
|
||||
return await api.createVersion({
|
||||
project_id: project.id,
|
||||
name: request.name,
|
||||
version_number: request.version,
|
||||
project_id: project.id,
|
||||
changelog: request.changelog,
|
||||
version_type: request.versionType,
|
||||
featured: request.featured,
|
||||
game_versions: gameVersions,
|
||||
loaders,
|
||||
dependencies,
|
||||
game_versions: gameVersions,
|
||||
version_type: request.versionType,
|
||||
loaders,
|
||||
featured: request.featured,
|
||||
files: request.files,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -411,14 +411,16 @@ export function packModrinthVersionInit(version: ModrinthVersionInit): ModrinthV
|
|||
const { files = [] } = version;
|
||||
|
||||
const data: ModrinthVersionInitData = {
|
||||
// Default values
|
||||
featured: true,
|
||||
dependencies: [],
|
||||
version_type: VersionType.RELEASE,
|
||||
|
||||
// Unpack the `version`
|
||||
...{ ...version, files: undefined },
|
||||
|
||||
// Default values
|
||||
name: version.name || version.version_number,
|
||||
version_type: version.version_type ?? VersionType.RELEASE,
|
||||
featured: version.featured ?? true,
|
||||
dependencies: version.dependencies ?? [],
|
||||
game_versions: version.game_versions ?? [],
|
||||
loaders: version.loaders ?? [],
|
||||
|
||||
// Names of each file part
|
||||
primary_file: files.length ? "_0" : undefined,
|
||||
|
|
Loading…
Reference in a new issue