tweak button styles, fix resource gathering

This commit is contained in:
moehreag 2024-06-08 18:12:21 +02:00
parent 6720aa156a
commit fe60674d7e

View file

@ -1,11 +1,11 @@
--- ---
# Here should be a mod template generator. Resources for this are in resources/template/.
title: Mod Template Generator title: Mod Template Generator
sidebar: false sidebar: false
prev: false prev: false
next: false next: false
editLink: false editLink: false
lastUpdated: false lastUpdated: false
outline: false
--- ---
<!-- This is a mess! Someone improve this please. --> <!-- This is a mess! Someone improve this please. -->
@ -13,6 +13,7 @@ lastUpdated: false
import JSZip from 'jszip' import JSZip from 'jszip'
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
const assetBaseUrl = "https://git.frogmc.dev/frogmc/frogmc.dev/raw/branch/mistress/resources/"
const gameVersion = ref('loading') const gameVersion = ref('loading')
const showSnapshots = ref() const showSnapshots = ref()
const versionSelector = ref() const versionSelector = ref()
@ -86,47 +87,47 @@ lastUpdated: false
let promises = [] let promises = []
promises.push( promises.push(
readAsset("/resources/template/gradle/libs.versions.toml").then((data) => { readAsset("/template/gradle/libs.versions.toml").then((data) => {
gradle.file("libs.versions.toml", data) gradle.file("libs.versions.toml", data)
}) })
) )
promises.push( promises.push(
readAssetBinary("/resources/template/gradle/wrapper/gradle-wrapper.properties").then((data) => { readAssetBinary("/template/gradle/wrapper/gradle-wrapper.properties").then((data) => {
wrapper.file("gradle-wrapper.properties", data) wrapper.file("gradle-wrapper.properties", data)
}) })
) )
promises.push( promises.push(
readAssetBinary("/resources/template/gradle/wrapper/gradle-wrapper.jar").then((data) => { readAssetBinary("/template/gradle/wrapper/gradle-wrapper.jar").then((data) => {
wrapper.file("gradle-wrapper.jar", data) wrapper.file("gradle-wrapper.jar", data)
}) })
) )
promises.push( promises.push(
readAsset("/resources/template/.gitignore").then((data) => { readAsset("/template/.gitignore").then((data) => {
zip.file(".gitignore", data) zip.file(".gitignore", data)
}) })
) )
promises.push( promises.push(
readAsset("/resources/template/build.gradle.kts").then((data) => { readAsset("/template/build.gradle.kts").then((data) => {
zip.file("build.gradle.kts", data) zip.file("build.gradle.kts", data)
}) })
) )
promises.push( promises.push(
readAssetBinary("/resources/template/gradlew.sh").then((data) => { readAssetBinary("/template/gradlew.sh").then((data) => {
zip.file("gradlew", data) zip.file("gradlew", data)
}) })
) )
promises.push( promises.push(
readAssetBinary("/resources/template/gradlew.bat").then((data) => { readAssetBinary("/template/gradlew.bat").then((data) => {
zip.file("gradlew.bat", data) zip.file("gradlew.bat", data)
}) })
) )
promises.push( promises.push(
readAsset("/resources/template/build.gradle.kts").then((data) => { readAsset("/template/build.gradle.kts").then((data) => {
zip.file("build.gradle.kts", data) zip.file("build.gradle.kts", data)
}) })
) )
promises.push( promises.push(
readAsset("/resources/template/settings.gradle.kts").then((data) => { readAsset("/template/settings.gradle.kts").then((data) => {
zip.file("settings.gradle.kts", data) zip.file("settings.gradle.kts", data)
}) })
) )
@ -135,12 +136,12 @@ lastUpdated: false
let java = main.folder("java") let java = main.folder("java")
let resources = main.folder("resources") let resources = main.folder("resources")
promises.push( promises.push(
readAsset("/resources/template/src/main/resources/frog.mod.toml").then((data) => { readAsset("/template/src/main/resources/frog.mod.toml").then((data) => {
resources.file("frog.mod.toml", data) resources.file("frog.mod.toml", data)
}) })
) )
promises.push( promises.push(
readAsset("/resources/template/src/main/resources/example_mod.mixins.json").then((data) => { readAsset("/template/src/main/resources/example_mod.mixins.json").then((data) => {
resources.file(modIdRef.value+".mixins.json", data) resources.file(modIdRef.value+".mixins.json", data)
}) })
) )
@ -155,12 +156,12 @@ lastUpdated: false
} }
async function readAssetBinary(path) { async function readAssetBinary(path) {
const response = await fetch(path) const response = await fetch(assetBaseUrl+path)
return await response.blob() return await response.blob()
} }
async function readAsset(path){ async function readAsset(path){
const response = await fetch(path) const response = await fetch(assetBaseUrl+path)
return await response.text().then((data) => { return await response.text().then((data) => {
data = data.replace(/\\$mod_id/g, modIdRef.value) data = data.replace(/\\$mod_id/g, modIdRef.value)
data = data.replace(/\\$mod_name/g, modNameRef.value) data = data.replace(/\\$mod_name/g, modNameRef.value)
@ -186,14 +187,20 @@ lastUpdated: false
input { input {
border: 4px solid var(--vp-c-brand-soft); border: 4px solid var(--vp-c-brand-soft);
} }
button {
background-color: var(--vp-button-brand-bg);
color: var(--vp-button-brand-text);
border-color: var(--vp-button-brand-border);
}
button:hover {
background-color: var(--vp-button-brand-hover-bg);
color: var(--vp-button-brand-hover-text);
border-color: var(--vp-button-brand-hover-border);
}
.generate { .generate {
padding: 4px; padding: 4px;
border: 4px solid var(--vp-c-brand-soft); //border: 4px solid var(--vp-c-brand-soft);
//border-color: var(--vp-c-brand-3); border-radius: 14px;
border-radius: 18px;
}
.generate:hover {
border-color: var(--vp-c-brand-2);
} }
</style> </style>