chore: move challenge-auditor out of root (#64280)

Co-authored-by: Sem Bauke <semboot699@gmail.com>
This commit is contained in:
Oliver Eyton-Williams
2025-12-02 16:06:49 +01:00
committed by GitHub
parent 9c40394914
commit 8ef4620e0b
4 changed files with 6 additions and 40 deletions

View File

@@ -18,6 +18,7 @@
"homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme",
"author": "freeCodeCamp <team@freecodecamp.org>",
"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",

View File

@@ -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'
);

View File

@@ -19,7 +19,7 @@
"author": "freeCodeCamp <team@freecodecamp.org>",
"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:*",

View File

@@ -2,7 +2,6 @@
"include": [
"*.ts",
"curriculum/*.test.ts",
"tools/challenge-auditor/index.ts",
"tools/challenge-editor/**/*",
"tools/scripts/**/*.ts",
"tools/daily-challenges/**/*.ts"