From 74de60a73f32f1cc00397f36ae883f69349c18a7 Mon Sep 17 00:00:00 2001 From: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Date: Mon, 28 Oct 2024 13:52:40 -0700 Subject: [PATCH] fix(client-plugins): default description, instructions, and seed to empty string (#56679) Co-authored-by: Oliver Eyton-Williams --- .../66a909dc2e382527ead44c23.md | 1 + curriculum/get-challenges.js | 4 ++++ .../create-challenge-nodes.js | 21 ------------------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/curriculum/challenges/english/24-b1-english-for-developers/learn-how-to-describe-places-and-events/66a909dc2e382527ead44c23.md b/curriculum/challenges/english/24-b1-english-for-developers/learn-how-to-describe-places-and-events/66a909dc2e382527ead44c23.md index 5786b04d650..2d4e35b6bf2 100644 --- a/curriculum/challenges/english/24-b1-english-for-developers/learn-how-to-describe-places-and-events/66a909dc2e382527ead44c23.md +++ b/curriculum/challenges/english/24-b1-english-for-developers/learn-how-to-describe-places-and-events/66a909dc2e382527ead44c23.md @@ -4,6 +4,7 @@ title: Task 1 challengeType: 19 dashedName: task-1 --- + # --instructions-- diff --git a/curriculum/get-challenges.js b/curriculum/get-challenges.js index dc1e05e2b5f..4d85e5272db 100644 --- a/curriculum/get-challenges.js +++ b/curriculum/get-challenges.js @@ -290,6 +290,10 @@ function generateChallengeCreator(lang, englishPath, i18nPath) { challenge.blockLayout = meta.blockLayout; challenge.hasEditableBoundaries = !!meta.hasEditableBoundaries; challenge.order = meta.order; + + if (!challenge.description) challenge.description = ''; + if (!challenge.instructions) challenge.instructions = ''; + // const superOrder = getSuperOrder(meta.superBlock); // NOTE: Use this version when a super block is in beta. const superOrder = getSuperOrder(meta.superBlock, { diff --git a/tools/client-plugins/gatsby-source-challenges/create-challenge-nodes.js b/tools/client-plugins/gatsby-source-challenges/create-challenge-nodes.js index 9c30d5be05a..e879e3d3cdd 100644 --- a/tools/client-plugins/gatsby-source-challenges/create-challenge-nodes.js +++ b/tools/client-plugins/gatsby-source-challenges/create-challenge-nodes.js @@ -7,27 +7,6 @@ function createChallengeNode( reporter, { isReloading } = { isReloading: false } ) { - // challengeType 11 is for video challenges (they only have instructions) - // challengeType 7 is for certificates (they only have tests) - // challengeType 12 is for CodeAlly/CodeRoad challenge - - // TODO: either handle empty descriptions inside Gatsby OR ensure that - // description defaults to '' when creating challenges. - // ditto for seeds and instructions. - // create-md should, then, not create empty seed, description or instruction - // sections. - if ( - typeof challenge.description !== 'string' && - challenge.challengeType !== 11 && - challenge.challengeType !== 7 && - challenge.challengeType !== 12 - ) { - reporter.warn(` - - ${challenge.title} has a description that will break things! - - `); - } const contentDigest = crypto .createHash('md5') .update(JSON.stringify(challenge))