fix: seeds go

This commit is contained in:
zkldi
2023-01-19 16:39:43 +00:00
parent d493475834
commit 1ab5819071
9 changed files with 32 additions and 36 deletions
+9 -7
View File
@@ -33,13 +33,15 @@ export function ClassValue<V extends string>(
return { id, display, hoverText };
}
export const zodTierlistData = z.nullable(
z.strictObject({
value: z.number(),
text: z.string(),
individualDifference: z.boolean(),
})
);
export const zodTierlistData = z
.nullable(
z.strictObject({
value: z.number(),
text: z.string(),
individualDifference: z.boolean(),
})
)
.optional();
export const zodInt = z.number().int();
export const zodNonNegativeInt = z.number().int().nonnegative();
+3 -3
View File
@@ -247,9 +247,9 @@ export const BMS_7K_CONF = {
hashMD5: z.string(),
hashSHA256: z.string(),
tableFolders: z.array(z.strictObject({ table: z.string(), level: z.string() })),
sglEC: z.number().nullable(),
sglHC: z.number().nullable(),
aiLevel: z.string().nullable(),
sglEC: z.number().nullable().optional(),
sglHC: z.number().nullable().optional(),
aiLevel: z.string().nullable().optional(),
}),
preferences: z.strictObject({
+4 -6
View File
@@ -44,14 +44,12 @@ const CURRENT_DATABASE_SEEDS: Record<keyof OtherDBSeeds, true> = {
"tables.json": true,
};
for (const game of allSupportedGames) {
// @ts-expect-error define all games' seeds on the object.
CURRENT_DATABASE_SEEDS[`songs-${game}`] = true;
const moreOnes: Array<string> = [];
// @ts-expect-error define all games' seeds on the object.
CURRENT_DATABASE_SEEDS[`charts-${game}`] = true;
for (const game of allSupportedGames) {
moreOnes.push(`songs-${game}`, `charts-${game}`);
}
export const DatabaseSeedNames = Object.keys(CURRENT_DATABASE_SEEDS) as Array<
export const DatabaseSeedNames = [...Object.keys(CURRENT_DATABASE_SEEDS), ...moreOnes] as Array<
keyof AllDatabaseSeeds
>;
@@ -1,9 +1,10 @@
import chalk from "chalk";
import fs from "fs";
import path from "path";
import { SCHEMAS } from "tachi-common/lib/schemas";
import { ReadCollection } from "../util";
import { FormatFunctions } from "./test-utils";
import { SCHEMAS } from "tachi-common/lib/schemas";
import { Game } from "tachi-common";
function FormatPrError(err, foreword = "Error") {
const receivedText =
@@ -28,7 +29,7 @@ for (const collection of collections) {
let fails = 0;
const collectionName = `${collection}.json`;
const formatFn = FormatFunctions[collection];
const formatFn = FormatFunctions[collection] ?? ((v) => JSON.stringify(v));
const data = ReadCollection(collectionName, true);
@@ -48,7 +49,7 @@ for (const collection of collections) {
for (const d of data) {
// Will throw if formatFn is undefined -- that's a test failure in my book.
const pretty = formatFn(d, game);
const pretty = formatFn(d, game as Game);
try {
validator(d);
+5 -7
View File
@@ -1,12 +1,10 @@
import chalk from "chalk";
import { Game, integer } from "tachi-common";
import { allSupportedGames } from "tachi-common/config/static-config";
import { SCHEMAS } from "tachi-common/lib/schemas";
import { ReadCollection } from "../util";
import { Game, allSupportedGames, integer } from "tachi-common";
import { FormatFunctions } from "./test-utils";
import get from "lodash.get";
import fjsh from "fast-json-stable-hash";
import logger from "../logger";
import { SCHEMAS } from "tachi-common/lib/schemas";
import { ReadCollection } from "../util";
// Either it's a bare string or an array of strings for co-uniqueness.
type DuplicateKeyDecl = string | string[];
@@ -88,7 +86,7 @@ for (const [collection, uniqueIDs] of Object.entries(UniqueKeys)) {
console.log(`[VALIDATING DUPES] ${collection}`);
const collectionName = `${collection}.json`;
const formatFn = FormatFunctions[collection];
const formatFn = FormatFunctions[collection] ?? ((v) => JSON.stringify(v));
let success = 0;
let fails = 0;
@@ -111,7 +109,7 @@ for (const [collection, uniqueIDs] of Object.entries(UniqueKeys)) {
const set = new Set<string>();
for (const d of data) {
const pretty = formatFn(d, game);
const pretty = formatFn(d, game as Game);
let value: Array<Array<string | number>>;
@@ -8,8 +8,8 @@ import {
MatchTypes,
Playtype,
SongDocument,
allSupportedGames,
} from "tachi-common";
import { allSupportedGames } from "tachi-common/config/static-config";
import { ReadCollection } from "../util";
// check that a given matchType works for a given game.
@@ -2,8 +2,7 @@
// and no quest-goal desync, etc.
import chalk from "chalk";
import { Game } from "tachi-common";
import { allSupportedGames } from "tachi-common/config/static-config";
import { Game, allSupportedGames } from "tachi-common";
import { ReadCollection } from "../util";
import { FormatFunctions } from "./test-utils";
@@ -63,7 +62,7 @@ for (const refCheck of refChecks) {
})
);
const formatFn = FormatFunctions[refCheck.base];
const formatFn = FormatFunctions[refCheck.base] ?? ((v) => JSON.stringify(v));
for (const data of baseData) {
const keys: Array<string> = [];
@@ -1,6 +1,5 @@
import chalk from "chalk";
import { FormatGame, TableDocument } from "tachi-common";
import { allGPTString } from "tachi-common/config/static-config";
import { FormatGame, TableDocument, allGPTStrings } from "tachi-common";
import { ReadCollection } from "../util";
const gptStringMap = {};
@@ -38,7 +37,7 @@ for (const t of tables) {
}
}
for (const gptString of allGPTString) {
for (const gptString of allGPTStrings) {
if (!gptStringMap[gptString]) {
console.log(chalk.red(`[TABLE-DEFAULT] There is no default table for ${gptString}.`));
errs += 1;
+2 -3
View File
@@ -1,7 +1,6 @@
import { Game } from "tachi-common";
import { allSupportedGames } from "tachi-common/config/static-config";
import { SCHEMAS } from "tachi-common/lib/schemas";
import { Game, allSupportedGames } from "tachi-common";
import { ReadCollection } from "../util";
import { SCHEMAS } from "tachi-common/lib/schemas";
const songMap = {};