refactor: just updated scripts for better reading

This commit is contained in:
snus xD
2025-12-24 09:35:53 +03:00
parent 14a1b9d5e7
commit f0b87a6da0
4 changed files with 95 additions and 105 deletions

28
scripts/shared.ts Normal file
View File

@@ -0,0 +1,28 @@
import fs from "node:fs";
const PATHS = {
ORIGINAL: "../_sprites/original",
TRANSLATION: "../_sprites/translation",
UNREADY: "../_sprites/unready",
SORTED: "../_sprites/sorted",
};
const DATA = JSON.parse(fs.readFileSync("./data.json", "utf-8"));
const CHAPTERS = Object.keys(DATA);
const UNIQUES = fs
.readFileSync("../_sprites/unique.txt", "utf-8")
.split("UNIQUE FOR SORTING:")
.at(-1)
?.split("UNIQUE FRAME COUNT:");
const UNIQUES_NAMES = UNIQUES != undefined ? UNIQUES[0].split("\n") : [];
UNIQUES_NAMES?.shift();
const UNIQUES_FRAMES = UNIQUES != undefined ? UNIQUES[1].split("\n") : [];
UNIQUES_FRAMES?.shift();
while (UNIQUES_NAMES?.at(-1) == "") UNIQUES_NAMES?.pop();
while (UNIQUES_FRAMES?.at(-1) == "") UNIQUES_FRAMES?.pop();
export { PATHS, DATA, CHAPTERS, UNIQUES_NAMES, UNIQUES_FRAMES };