22 * Example usage in root or frontend:
33 * pnpm check-assets (npm run check-assets)
44 * pnpm check-assets -- -- quotes others (npm run check-assets -- -- quotes others)
5- * pnpm check-assets -- -- challenges sound -p (npm run check-assets -- -- challenges sound -p)
65 */
76
87import * as fs from "fs" ;
@@ -18,7 +17,6 @@ import { KnownFontName } from "@monkeytype/schemas/fonts";
1817import { Fonts } from "../src/ts/constants/fonts" ;
1918import { themes , ThemeSchema , ThemesList } from "../src/ts/constants/themes" ;
2019import { z } from "zod" ;
21- import { ChallengeSchema , Challenge } from "@monkeytype/schemas/challenges" ;
2220import { LayoutObject , LayoutObjectSchema } from "@monkeytype/schemas/layouts" ;
2321import { QuoteDataSchema , QuoteData } from "@monkeytype/schemas/quotes" ;
2422import { clickSoundConfig } from "../src/ts/constants/sounds" ;
@@ -99,24 +97,6 @@ function findDuplicates<T>(items: T[]): T[] {
9997 return Array . from ( duplicates ) ;
10098}
10199
102- async function validateChallenges ( ) : Promise < void > {
103- const problems = new Problems < "_list.json" , never > ( "Challenges" , { } ) ;
104-
105- const challengesData = JSON . parse (
106- fs . readFileSync ( "./static/challenges/_list.json" , {
107- encoding : "utf8" ,
108- flag : "r" ,
109- } ) ,
110- ) as Challenge ;
111- const validationResult = z . array ( ChallengeSchema ) . safeParse ( challengesData ) ;
112- problems . addValidation ( "_list.json" , validationResult ) ;
113-
114- console . log ( problems . toString ( ) ) ;
115- if ( problems . hasError ( ) ) {
116- throw new Error ( "challenges with errors" ) ;
117- }
118- }
119-
120100async function validateLayouts ( ) : Promise < void > {
121101 const problems = new Problems < Layout , "_additional" > ( "Layouts" , {
122102 _additional :
@@ -496,17 +476,10 @@ async function main(): Promise<void> {
496476 quotes : [ validateQuotes ] ,
497477 languages : [ validateLanguages ] ,
498478 layouts : [ validateLayouts ] ,
499- challenges : [ validateChallenges ] ,
500479 fonts : [ validateFonts ] ,
501480 themes : [ validateThemes ] ,
502481 sounds : [ validateSounds ] ,
503- others : [
504- validateChallenges ,
505- validateLayouts ,
506- validateFonts ,
507- validateThemes ,
508- validateSounds ,
509- ] ,
482+ others : [ validateLayouts , validateFonts , validateThemes , validateSounds ] ,
510483 } ;
511484
512485 // flags
0 commit comments