Move public assets to stable paths
This commit is contained in:
@@ -2,11 +2,11 @@ import { spawn } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { mkdir, copyFile } from "node:fs/promises";
|
||||
const windows = process.platform === "win32";
|
||||
const command = windows ? "gradlew.bat" : "./gradlew";
|
||||
const command = windows ? "gradlew.bat" : "sh";
|
||||
const targets = process.argv.slice(2);
|
||||
if (!targets.length) targets.push(":plugin:build", ":fabric:build");
|
||||
await new Promise((resolve, reject) => {
|
||||
const child = spawn(command, targets, {
|
||||
const child = spawn(command, windows ? targets : ["./gradlew", ...targets], {
|
||||
cwd: "minecraft",
|
||||
stdio: "inherit",
|
||||
shell: windows,
|
||||
@@ -16,9 +16,15 @@ await new Promise((resolve, reject) => {
|
||||
code === 0 ? resolve() : reject(new Error(`Gradle exited ${code}`)),
|
||||
);
|
||||
});
|
||||
await mkdir("public/downloads", { recursive: true });
|
||||
for (const name of ["plugin", "fabric"]) {
|
||||
const directory = `public/tools/${name === "fabric" ? "mod" : "plugin"}`;
|
||||
const file = `minegeo-${name}-1.21.11.jar`,
|
||||
path = `minecraft/${name}/build/libs/${file}`;
|
||||
if (existsSync(path)) await copyFile(path, `public/downloads/${file}`);
|
||||
if (existsSync(path)) {
|
||||
await mkdir(directory, { recursive: true });
|
||||
await copyFile(path, `${directory}/${file}`);
|
||||
console.log(
|
||||
`Updated ${directory}/${file}. Include this JAR in your next commit.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user