diff --git a/tools/challenge-auditor/index.ts b/tools/challenge-auditor/index.ts index 8641570bf96..2c5569e6c25 100644 --- a/tools/challenge-auditor/index.ts +++ b/tools/challenge-auditor/index.ts @@ -1,4 +1,4 @@ -import { access, readdir } from 'fs/promises'; +import { readdir } from 'fs/promises'; import { join, resolve } from 'path'; import { flatten } from 'lodash/fp'; @@ -82,30 +82,9 @@ void (async () => { for (const language of langsToCheck) { console.log(`\n=== ${language} ===`); const certs = getAuditedSuperBlocks({ language }); - const langCurriculumDirectory = join( - process.cwd(), - 'curriculum', - 'i18n-curriculum', - 'curriculum', - 'challenges', - language - ); - // TODO: decide if we need to audit files at all. - const auditedFiles = englishFilePaths; - // const auditedFiles = englishFilePaths.filter(file => - // certs.some( - // cert => - // // we're not ready to audit the new curriculum yet - // (cert !== SuperBlocks.JsAlgoDataStructNew || - // process.env.SHOW_UPCOMING_CHANGES === 'true') && - // file.startsWith(superBlockToFolderMap[cert]) - // ) - // ); - const noMissingFiles = await auditChallengeFiles(auditedFiles, { - langCurriculumDirectory - }); + const noDuplicateSlugs = await auditSlugs(language, certs); - if (noMissingFiles && noDuplicateSlugs) { + if (noDuplicateSlugs) { console.log(`All challenges pass.`); } else { actionShouldFail = true; @@ -114,24 +93,6 @@ void (async () => { process.exit(actionShouldFail ? 1 : 0); })(); -async function auditChallengeFiles( - auditedFiles: string[], - { langCurriculumDirectory }: { langCurriculumDirectory: string } -) { - let auditPassed = true; - for (const file of auditedFiles) { - const filePath = join(langCurriculumDirectory, file); - const fileExists = await access(filePath) - .then(() => true) - .catch(() => false); - if (!fileExists) { - console.log(`${filePath} does not exist.`); - auditPassed = false; - } - } - return auditPassed; -} - async function auditSlugs(lang: string, certs: SuperBlocks[]) { let auditPassed = true; const slugs = new Map();