diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1bff227 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Preserve downloadable files exactly and keep the Unix wrapper runnable on macOS. +*.jar binary +*.webp binary +minecraft/gradlew text eol=lf diff --git a/.gitignore b/.gitignore index 1caafc9..54e93bf 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,7 @@ artifacts/ **/build/ playwright-report/ test-results/ +# Local renderer outputs and legacy build copies. The site's example image in +# public/images/ and distributable JARs in public/tools/ are committed to Git. public/generated/ public/downloads/*.jar diff --git a/app/downloads/page.tsx b/app/downloads/page.tsx index 2cd4cdf..343ea73 100644 --- a/app/downloads/page.tsx +++ b/app/downloads/page.tsx @@ -4,8 +4,8 @@ import { existsSync } from "node:fs"; import Link from "next/link"; export const dynamic = "force-dynamic"; export default function Downloads() { - const fabric = existsSync("public/downloads/minegeo-fabric-1.21.11.jar"), - plugin = existsSync("public/downloads/minegeo-plugin-1.21.11.jar"); + const fabric = existsSync("public/tools/mod/minegeo-fabric-1.21.11.jar"), + plugin = existsSync("public/tools/plugin/minegeo-plugin-1.21.11.jar"); return ( <>
@@ -37,7 +37,7 @@ export default function Downloads() { {fabric ? ( Download Fabric mod @@ -68,7 +68,7 @@ export default function Downloads() { {plugin ? ( Download server plugin diff --git a/app/page.tsx b/app/page.tsx index b1fc61f..8ac0125 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -70,7 +70,7 @@ export default async function Home() {
Top-down map of the real Paper renderer test world
{`${map.name} { - 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.`, + ); + } } diff --git a/scripts/seed-proof.ts b/scripts/seed-proof.ts index ae3aa3f..7e64ef2 100644 --- a/scripts/seed-proof.ts +++ b/scripts/seed-proof.ts @@ -1,21 +1,73 @@ -import {createClient} from '@supabase/supabase-js'; -import {createHash,randomBytes} from 'node:crypto'; -import {mkdir,readFile,writeFile} from 'node:fs/promises'; -import {existsSync} from 'node:fs'; -process.loadEnvFile('.env.local'); -const client=createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!,process.env.SUPABASE_SECRET_KEY!,{auth:{persistSession:false}}); -function check(r:{data:T,error:{message:string}|null}):NonNullable{if(r.error)throw new Error(r.error.message);return r.data!;} -await mkdir('.data',{recursive:true}); -if(!existsSync('.data/test-account.json')){ - const password=randomBytes(32).toString('hex'),token='mg_'+randomBytes(32).toString('hex'),email='minegeo-fixture-'+randomBytes(4).toString('hex')+'@example.com'; - const {user}=check(await client.auth.admin.createUser({email,password,email_confirm:true}));if(!user)throw new Error('No fixture account returned'); - check(await client.from('profiles').insert({id:user.id,display_name:'MineGeo test world',role:'moderator'})); - check(await client.from('contributor_tokens').insert({owner_id:user.id,token_hash:createHash('sha256').update(token).digest('hex'),label:'Local integration fixture'})); - await writeFile('.data/test-account.json',JSON.stringify({id:user.id,email,password,token})); +import { createClient } from "@supabase/supabase-js"; +import { createHash, randomBytes } from "node:crypto"; +import { mkdir, readFile, writeFile } from "node:fs/promises"; +import { existsSync } from "node:fs"; +process.loadEnvFile(".env.local"); +const client = createClient( + process.env.NEXT_PUBLIC_SUPABASE_URL!, + process.env.SUPABASE_SECRET_KEY!, + { auth: { persistSession: false } }, +); +function check(r: { + data: T; + error: { message: string } | null; +}): NonNullable { + if (r.error) throw new Error(r.error.message); + return r.data!; } -const manifest=JSON.parse(await readFile('.cache/paper-proof/plugins/MineGeo/export/manifest.json','utf8')); -manifest.name='The First Expedition';manifest.serverName='MineGeo Test World';manifest.description='A real Paper 1.21.11 renderer test world: terrain, water and a builder’s outpost. Exported with no connected capture player. This small map is for trying MineGeo.'; -await mkdir('.data/proof-upload',{recursive:true}); -await writeFile('.data/proof-upload/manifest.json',JSON.stringify(manifest)); -await writeFile('.data/proof-upload/terrain.json.gz',await readFile('.cache/paper-proof/plugins/MineGeo/export/terrain.json.gz')); -console.log('Fixture contributor and real Paper upload are ready. Credentials remain in ignored local files.'); +await mkdir(".data", { recursive: true }); +if (!existsSync(".data/test-account.json")) { + const password = randomBytes(32).toString("hex"), + token = "mg_" + randomBytes(32).toString("hex"), + email = + "minegeo-fixture-" + randomBytes(4).toString("hex") + "@example.com"; + const created = await client.auth.admin.createUser({ + email, + password, + email_confirm: true, + }); + if (created.error) throw new Error(created.error.message); + const user = created.data.user; + if (!user) throw new Error("No fixture account returned"); + check( + await client + .from("profiles") + .insert({ + id: user.id, + display_name: "MineGeo test world", + role: "moderator", + }), + ); + check( + await client + .from("contributor_tokens") + .insert({ + owner_id: user.id, + token_hash: createHash("sha256").update(token).digest("hex"), + label: "Local integration fixture", + }), + ); + await writeFile( + ".data/test-account.json", + JSON.stringify({ id: user.id, email, password, token }), + ); +} +const manifest = JSON.parse( + await readFile( + ".cache/paper-proof/plugins/MineGeo/export/manifest.json", + "utf8", + ), +); +manifest.name = "The First Expedition"; +manifest.serverName = "MineGeo Test World"; +manifest.description = + "A real Paper 1.21.11 renderer test world: terrain, water and a builder’s outpost. Exported with no connected capture player. This small map is for trying MineGeo."; +await mkdir(".data/proof-upload", { recursive: true }); +await writeFile(".data/proof-upload/manifest.json", JSON.stringify(manifest)); +await writeFile( + ".data/proof-upload/terrain.json.gz", + await readFile(".cache/paper-proof/plugins/MineGeo/export/terrain.json.gz"), +); +console.log( + "Fixture contributor and real Paper upload are ready. Credentials remain in ignored local files.", +); diff --git a/scripts/setup.mjs b/scripts/setup.mjs index 1bdbc6c..c08e723 100644 --- a/scripts/setup.mjs +++ b/scripts/setup.mjs @@ -5,7 +5,8 @@ import { prepareAssets } from "./assets.mjs"; if (!existsSync(".env.local")) await copyFile(".env.example", ".env.local"); await mkdir(".data", { recursive: true }); await mkdir("public/generated", { recursive: true }); -await mkdir("public/downloads", { recursive: true }); +await mkdir("public/tools/mod", { recursive: true }); +await mkdir("public/tools/plugin", { recursive: true }); await new Promise((resolve, reject) => { const p = spawn( process.execPath,