From a7f11d3d9f82071491d1bb0b7e570b087f8d50c0 Mon Sep 17 00:00:00 2001 From: intergrav Date: Tue, 4 Jun 2024 18:50:39 -0400 Subject: [PATCH] feat: add SkywardMC justfile for batch operations and more --- justfile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 000000000..e9bc922ab --- /dev/null +++ b/justfile @@ -0,0 +1,47 @@ +# justfile is from SkywardMC https://github.com/skywardmc/.github +alias e := export +alias r := refresh +alias u := update + +set windows-shell := ["powershell.exe", "-NoLogo", "-Command"] + +default: + @just --list + +[private] +[windows] +_batchcmd cmd loader: + Get-ChildItem -Path versions\{{ if loader == "all" { "*\\*" } else { loader } }} -Directory | % { \ + Set-Location $_.FullName; \ + Write-Host "running {{ cmd }} in" versions\loader\$_; \ + Invoke-Expression "{{ cmd }}"; \ + Pop-Location; \ + } + +[linux] +[macos] +[private] +_batchcmd cmd loader: + for d in versions/{{ if loader == "all" { "*" } else { loader } }}/*/; do \ + pushd "$d" &> /dev/null; \ + echo "running {{ cmd }} in $d..."; \ + {{ cmd }}; \ + popd &> /dev/null; \ + done + +# all versions of (or "all") will be exported as a modrinth modpack +[linux] +[macos] +export loader: && (_batchcmd "packwiz modrinth export; mv *.mrpack ../../../build/" loader) + -mkdir -p build/ + +# all versions of (or "all") will be exported as a modrinth modpack +[windows] +export loader: && (_batchcmd "packwiz modrinth export; Move-Item -Force -Path *.mrpack -Destination ../../../build/" loader) + -New-Item -Force -Type Directory -Path build/ + +# all versions of (or "all") will have pack.toml & index.toml refreshed +refresh loader: && (_batchcmd "packwiz refresh" loader) + +# all versions of (or "all") will be updated +update loader: && (_batchcmd "packwiz update --all" loader)