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
+37
View File
@@ -0,0 +1,37 @@
const childProcess = require("node:child_process")
function getJavaVersionOutput(defaultCommand = "java") {
try {
const command = childProcess.spawnSync(defaultCommand, ["-version"], {
encoding: "utf-8",
windowsHide: true,
})
if (command.error) {
return null
}
return command.stderr || command.stdout || ""
} catch {
return null
}
}
function parseJavaOutput(output) {
if (!output || typeof output !== "string") {
return null
}
const match = output.match(/version\s+"(?:1\.)?(\d+)/i)
return match ? parseInt(match[1], 10) : null
}
function isJavaCompatible(output, requiredMajor) {
return parseJavaOutput(output) === requiredMajor
}
module.exports = {
getJavaVersionOutput,
isJavaCompatible,
parseJavaOutput,
}