asajs configuration file

This commit is contained in:
Asaki Yuki 2026-01-30 03:33:27 +07:00
parent e75e45d056
commit 4ad9e832bd
10 changed files with 76 additions and 18 deletions

View file

@ -25,7 +25,7 @@ function genUUID(): string {
}
export async function clearBuild() {
await Promise.all(prevData.files.map(file => fs.rm(`build/build/${file}`).catch(() => null)))
await Promise.all(prevData.files.map(file => fs.rm(`build/${file}`).catch(() => null)))
}
export async function createBuildFolder() {
@ -40,13 +40,22 @@ export async function getBuildFolderName() {
}
export async function linkToGame() {
const sourcePath = path.resolve("build/build")
const sourcePath = path.resolve("build")
const targetPath = path.resolve(getGamedataPath(), "development_resource_packs", await getBuildFolderName())
await fs.stat(targetPath).catch(async () => {
await fs.symlink(sourcePath, targetPath, "junction")
})
}
export async function unlink() {
const targetPath = path.resolve(getGamedataPath(), "development_resource_packs", await getBuildFolderName())
try {
await fs.unlink(targetPath)
} catch (error) {
console.error(error)
}
}
export async function getUUID(): Promise<[string, string]> {
return await BuildCache.getWithSetDefault("uuid", () => {
return [genUUID(), genUUID()]