Add initial minecraft-java-manager scaffold

Initial project scaffold for minecraft-java-manager. Adds package.json and package-lock.json, README update, index.js entrypoint and test.js. Introduces src modules: checker (detects Java version), installer (downloads JRE components with redirects, SHA1 validation, progress/events and concurrency), web (fetches launcher/runtime manifests and component data), systeminfo (platform key and install path resolution) and config (endpoints). Declares dependencies adm-zip and node-downloader-helper.
This commit is contained in:
2026-09-06 03:58:25 +02:00
parent 8750661f49
commit e9bc3807ae
10 changed files with 516 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
const installer = require("./src/installer")
const checker = require("./src/checker")
const sysinfo = require("./src/systeminfo")
const web = require("./src/web")
async function isJavaInstalledAndCompatibleFor(mcVersion, customExec = "java") {
const mcVersionManifestUrl = await web.getVersionManifest(mcVersion)
const requiredJRE = await web.getRequiredJREFor(mcVersionManifestUrl)
const checkJRECommand = checker.getJavaVersionOutput(customExec)
const isJavaCompatible = checker.isJavaCompatible(checkJRECommand, requiredJRE.majorVersion)
return isJavaCompatible
}
async function installJava(component, majorVersion, customInstallPath = null) {
const installationPath = await sysinfo.determineInstallationPath(component, majorVersion, customInstallPath)
const requiredComponentDetails = await web.getJREComponentDetails(component, sysinfo.getPlatformKey())
const requiredComponentManifest = await web.getJREComponentManifest(requiredComponentDetails[0].manifest.url)
return await installer.downloadJavaComponent(requiredComponentManifest, installationPath)
}
module.exports = {
isJavaInstalledAndCompatibleFor,
installJava
}