feat: add the instance class

This commit is contained in:
HerozDotExe 2025-11-25 21:53:38 +01:00
parent 3db0007789
commit 2819f164bc
17 changed files with 225 additions and 13 deletions

View file

@ -1,5 +1,5 @@
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import * as nlk from "../../dist/index.js";
import path from "path";
import { v3 } from "uuid";

View file

@ -1,5 +1,5 @@
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import * as nlk from "../../dist/index.js";
import path from "path";
import fs from "fs/promises";

View file

@ -1,10 +1,10 @@
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import * as nlk from "../../dist/index.js";
import path from "path";
import fs from "fs/promises";
const javaPath = path.join(import.meta.dirname, "temp/java");
await fs.rm(javaPath, { recursive: true });
await fs.rm(javaPath, { recursive: true, force: true });
await fs.mkdir(javaPath, { recursive: true });
async function exists(path: string) {

View file

@ -1,5 +1,5 @@
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import * as nlk from "../../dist/index.js";
import path from "path";
import fs from "fs/promises";

View file

@ -1,5 +1,5 @@
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import * as nlk from "../../dist/index.js";
import path from "path";
import { hash } from "crypto";
import fs from "fs/promises";

View file

@ -1,5 +1,5 @@
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import * as nlk from "../../dist/index.js";
import path from "path";
import fs from "fs/promises";

View file

@ -1,5 +1,5 @@
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import * as nlk from "../../dist/index.js";
import path from "path";
import fs from "fs/promises";

View file

@ -0,0 +1,21 @@
import { test } from "vitest";
import { Instance, offlineAuth } from "../../dist/index.js";
import path from "path";
import fs from "fs/promises";
const gameRoot = path.join(import.meta.dirname, "temp");
await fs.rm(gameRoot, { recursive: true, force: true });
await fs.mkdir(gameRoot, { recursive: true });
test("launch game", { timeout: 0 }, async () => {
const instance = new Instance();
const auth = offlineAuth("player");
instance.setVersion("1.21.8");
instance.setPaths(gameRoot);
instance.setAuth(auth);
await instance.install();
await instance.launch();
});