Compare commits

...

2 commits

Author SHA1 Message Date
794f344fa4 build: bump minor 2026-06-29 20:58:05 +02:00
23639e867e fix: handle when there is no overrides in the modpack 2026-06-29 20:57:55 +02:00
3 changed files with 44 additions and 20 deletions

View file

@ -1,7 +1,7 @@
{
"name": "node-launcher-kit",
"homepage": "https://github.com/HerozDotExe/node-launcher-kit",
"version": "2.1.1",
"version": "2.1.2",
"description": "A typescript library to install and launch minecraft with or without modloaders.",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -187,11 +187,12 @@ export async function getOverridesChanges(
addedDirs.push(
path.relative(overridesPath, path.join(file.parentPath, file.name)),
);
} else
} else {
addedOverrides.push(
path.relative(overridesPath, path.join(file.parentPath, file.name)),
);
}
}
return {
addedOverrides,
@ -224,10 +225,24 @@ export async function generatePackChanges(
manifest,
oldManifest,
);
const overridesChanges = await getOverridesChanges(
let overridesChanges: Awaited<ReturnType<typeof getOverridesChanges>> = {
addedDirs: [],
addedOverrides: [],
removedDirs: [],
removedOverrides: [],
};
if (
await exists(
path.join(tempFolder, "pack", "overrides"),
)
) {
overridesChanges = await getOverridesChanges(
instanceFolder,
tempFolder,
);
}
return { modrinthChanges, overridesChanges };
}
@ -241,7 +256,7 @@ export async function ModrinthDownloader(
concurrency: 5,
},
updateSize: true,
overwrite: true
overwrite: true,
});
modrinthDownloader.on("completed", () => {

View file

@ -1,11 +1,11 @@
import { EventEmitter } from "events";
import {
Config,
FinalConfig,
InstanceEvents,
logger,
Version,
FinalConfig,
ModloaderConfig,
Version,
} from "../utils/types";
import path from "node:path";
import {
@ -53,8 +53,8 @@ export function defineConfig(logger: logger, config: Config) {
instance: config.paths.instance,
versions: config.paths.versions ?? path.join(config.paths.root, "versions"),
assets: config.paths.assets ?? path.join(config.paths.root, "assets"),
libraries:
config.paths.libraries ?? path.join(config.paths.root, "libraries"),
libraries: config.paths.libraries ??
path.join(config.paths.root, "libraries"),
};
config.args = {
@ -267,15 +267,24 @@ export class Instance extends EventEmitter<InstanceEvents> {
// Delete before downloading
await ProjectsDeleter(modrinthChanges.removedProject, (...args) => this.emit(...args));
await ProjectsDeleter(
modrinthChanges.removedProject,
(...args) => this.emit(...args),
);
await ModrinthDownloader(modrinthChanges.addedProjects, (...args) => this.emit(...args));
await ModrinthDownloader(
modrinthChanges.addedProjects,
(...args) => this.emit(...args),
);
await OverridesDeleter(overridesChanges, (...args) => this.emit(...args));
await OverridesDeleter(
overridesChanges,
(...args) => this.emit(...args),
);
await OverridesCopier(
overridesChanges.addedOverrides,
path.join(this.config.modrinth.tempFolder, 'pack', 'overrides'),
path.join(this.config.modrinth.tempFolder, "pack", "overrides"),
this.config.paths.instance,
(...args) => this.emit(...args),
);