mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
fix(tools): insert step with appropriate challenge type (#62179)
This commit is contained in:
committed by
GitHub
parent
fbf6bf2bcd
commit
054d2448fa
@@ -4,7 +4,7 @@ import { getMetaData } from './helpers/project-metadata';
|
||||
import {
|
||||
createStepFile,
|
||||
deleteStepFromMeta,
|
||||
getChallengeSeeds,
|
||||
getChallenge,
|
||||
insertStepIntoMeta,
|
||||
updateStepTitles
|
||||
} from './utils';
|
||||
@@ -43,15 +43,20 @@ async function insertStep(stepNum: number): Promise<void> {
|
||||
}.`
|
||||
);
|
||||
|
||||
const challengeSeeds =
|
||||
stepNum > 1
|
||||
? getChallengeSeeds(
|
||||
`${getProjectPath()}${challengeOrder[stepNum - 2].id}.md`
|
||||
)
|
||||
: {};
|
||||
const previousChallenge =
|
||||
stepNum > 1 ? getChallenge(challengeOrder[stepNum - 2].id) : null;
|
||||
const nextChallenge =
|
||||
stepNum <= challengeOrder.length
|
||||
? getChallenge(challengeOrder[stepNum - 1].id)
|
||||
: null;
|
||||
|
||||
const challengeSeeds = previousChallenge?.challengeFiles ?? [];
|
||||
const challengeType =
|
||||
previousChallenge?.challengeType ?? nextChallenge?.challengeType;
|
||||
|
||||
const stepId = createStepFile({
|
||||
stepNum,
|
||||
challengeType,
|
||||
challengeSeeds
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user