From 8ef4620e0b718cb3f9d6cf17787deacbdd8b94f1 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Tue, 2 Dec 2025 16:06:49 +0100 Subject: [PATCH] chore: move challenge-auditor out of root (#64280) Co-authored-by: Sem Bauke --- curriculum/package.json | 1 + .../src}/challenge-auditor/index.ts | 42 ++----------------- package.json | 2 +- tsconfig.json | 1 - 4 files changed, 6 insertions(+), 40 deletions(-) rename {tools => curriculum/src}/challenge-auditor/index.ts (63%) diff --git a/curriculum/package.json b/curriculum/package.json index 10b24cdb6a9..a5e89c60d39 100644 --- a/curriculum/package.json +++ b/curriculum/package.json @@ -18,6 +18,7 @@ "homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme", "author": "freeCodeCamp ", "scripts": { + "audit-challenges": "pnpm -w run compile:ts && tsx ./src/challenge-auditor/index.ts", "build": "tsx ./src/generate/build-curriculum", "compile": "tsc --build --clean && tsc --build", "create-empty-steps": "CALLING_DIR=$INIT_CWD tsx --tsconfig ../tsconfig.json ../tools/challenge-helper-scripts/create-empty-steps", diff --git a/tools/challenge-auditor/index.ts b/curriculum/src/challenge-auditor/index.ts similarity index 63% rename from tools/challenge-auditor/index.ts rename to curriculum/src/challenge-auditor/index.ts index 7b5dfac4818..ae7e6c25013 100644 --- a/tools/challenge-auditor/index.ts +++ b/curriculum/src/challenge-auditor/index.ts @@ -1,18 +1,11 @@ -import { readdir } from 'fs/promises'; -import { join, resolve } from 'path'; - import { flatten } from 'lodash/fp'; -import { config } from 'dotenv'; -const envPath = resolve(__dirname, '../../.env'); -config({ path: envPath }); - -import { availableLangs } from '../../shared/config/i18n'; -import { getChallengesForLang } from '../../curriculum/src/get-challenges'; +import { availableLangs } from '../../../shared/config/i18n'; +import { getChallengesForLang } from '../get-challenges'; import { SuperBlocks, getAuditedSuperBlocks -} from '../../shared/config/curriculum'; +} from '../../../shared/config/curriculum'; // TODO: re-organise the types to a common 'types' folder that can be shared // between the workspaces so we don't have to declare ChallengeNode here and in @@ -30,10 +23,6 @@ type ChallengeNode = { // Adding types for getChallengesForLang is possible, but not worth the effort // at this time. -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ const getChallenges = async (lang: string) => { const curriculum = await getChallengesForLang(lang); @@ -50,32 +39,9 @@ const getChallenges = async (lang: string) => { ); }; -/* eslint-enable @typescript-eslint/no-unsafe-return */ -/* eslint-enable @typescript-eslint/no-unsafe-argument */ -/* eslint-enable @typescript-eslint/no-unsafe-assignment */ -/* eslint-enable @typescript-eslint/no-unsafe-member-access */ - void (async () => { let actionShouldFail = false; - const englishCurriculumDirectory = join( - process.cwd(), - 'curriculum', - 'challenges', - 'english' - ); - const englishFilePaths: string[] = []; - const englishBlocks = await readdir(englishCurriculumDirectory); - for (const englishBlock of englishBlocks) { - if (englishBlock.endsWith('.txt')) { - continue; - } - const englishChallenges = await readdir( - join(englishCurriculumDirectory, englishBlock) - ); - for (const englishChallenge of englishChallenges) { - englishFilePaths.push(join(englishBlock, englishChallenge)); - } - } + const langsToCheck = availableLangs.curriculum.filter( lang => String(lang) !== 'english' ); diff --git a/package.json b/package.json index b8b364bd280..9f9f265c445 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "author": "freeCodeCamp ", "main": "none", "scripts": { - "audit-challenges": "pnpm run compile:ts && tsx tools/challenge-auditor/index.ts", + "audit-challenges": "cd curriculum && pnpm audit-challenges", "analyze-bundle": "webpack-bundle-analyzer", "prebuild": "npm-run-all compile:ts", "build": "npm-run-all -p build:*", diff --git a/tsconfig.json b/tsconfig.json index 33187b58b88..b3559c68661 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,6 @@ "include": [ "*.ts", "curriculum/*.test.ts", - "tools/challenge-auditor/index.ts", "tools/challenge-editor/**/*", "tools/scripts/**/*.ts", "tools/daily-challenges/**/*.ts"