feat: add more log about which step is running

This commit is contained in:
HerozDotExe 2026-03-26 22:20:56 +01:00
parent 34d690d6a6
commit 21c09be4cd
2 changed files with 20 additions and 5 deletions

View file

@ -8,8 +8,8 @@ export function launch(
logger: logger,
detached = false,
) {
logger("launch", `[nlk ${packageVersion}] Working directory : ${gameRoot}`);
logger("launch",
logger("launch-process", `[nlk ${packageVersion}] Working directory : ${gameRoot}`);
logger("launch-process",
`[nlk ${packageVersion}] Launching command : ${launchArguments.command} ${launchArguments.args.join(" ")}`,
);

View file

@ -99,6 +99,9 @@ export class Instance extends EventEmitter<InstanceEvents> {
throw new InstallError("An error occured while initializing instance", "install-init", this.config, this.logger, { cause: error })
}
this.log("libraries", "Downloading libraries")
try {
const librariesDownloader = await LibrariesDownloader(
this.config.paths.libraries,
@ -121,6 +124,8 @@ export class Instance extends EventEmitter<InstanceEvents> {
throw new InstallError("An error occured while downloading libraries", "libraries", this.config, this.logger, { cause: error })
}
this.log("assets", "Downloading assets")
try {
const assetsDownloader = await AssetsDownloader(
this.config.paths.assets,
@ -143,6 +148,8 @@ export class Instance extends EventEmitter<InstanceEvents> {
throw new InstallError("An error occured while downloading assets", "assets", this.config, this.logger, { cause: error })
}
this.log("natives", "Downloading natives")
try {
const nativesDownloader = await NativesDownloader(
path.join(this.config.paths.instance, "natives"),
@ -160,15 +167,18 @@ export class Instance extends EventEmitter<InstanceEvents> {
});
await nativesDownloader.run();
} catch (error) {
throw new InstallError("An error occured while downloadng natives", "natives", this.config, this.logger, { cause: error })
throw new InstallError("An error occured while downloading natives", "natives", this.config, this.logger, { cause: error })
}
this.log("java", "Checking java")
const javaError = await checkJava(this.config.javaExecutable)
if (javaError) {
throw new InstallError("Invalid java provided", "java", this.config, this.logger, { cause: javaError })
}
if (this.config.modloader) {
this.log("install-modloader", "Installing modloader")
try {
switch (this.config.modloader.name) {
case "forge":
@ -185,7 +195,7 @@ export class Instance extends EventEmitter<InstanceEvents> {
throw new Error("Unknown modloader");
}
} catch (error) {
throw new InstallError("An error occured while installing the modloader", "modloader", this.config, this.logger, { cause: error })
throw new InstallError("An error occured while installing the modloader", "install-modloader", this.config, this.logger, { cause: error })
}
}
}
@ -198,6 +208,7 @@ export class Instance extends EventEmitter<InstanceEvents> {
}
if (this.config.modloader) {
this.log("launch-modloader", "Preparing modloader")
try {
switch (this.config.modloader.name) {
case "forge":
@ -209,10 +220,12 @@ export class Instance extends EventEmitter<InstanceEvents> {
throw new Error("Unknown modloader");
}
} catch (error) {
throw new LaunchError("An error occured while preparing the modloader", "modloader", this.config, this.logger, { cause: error })
throw new LaunchError("An error occured while preparing the modloader", "launch-modloader", this.config, this.logger, { cause: error })
}
}
this.log("arguments", "Preparing launch arguments")
let args;
try {
args = await argumentsGenerator.generateLaunchArguments(
@ -224,6 +237,8 @@ export class Instance extends EventEmitter<InstanceEvents> {
throw new LaunchError("An error occured while generating launch arguments", "arguments", this.config, this.logger, { cause: error })
}
this.log("launch-process", "Preparing launch arguments")
try {
const process = launch(args!, this.config.paths.instance, this.logger);