MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / insertStepIntoMeta

Function insertStepIntoMeta

tools/challenge-helper-scripts/utils.ts:152–164  ·  view source on GitHub ↗
({ stepNum, stepId }: InsertOptions)

Source from the content-addressed store, hash-verified

150}
151
152async function insertStepIntoMeta({ stepNum, stepId }: InsertOptions) {
153 const existingMeta = getMetaData();
154 const oldOrder = [...existingMeta.challengeOrder];
155
156 oldOrder.splice(stepNum - 1, 0, { id: stepId.toString(), title: '' });
157 // rename all the files in challengeOrder
158 const challengeOrder = oldOrder.map(({ id }, index) => ({
159 id,
160 title: `Step ${index + 1}`
161 }));
162
163 await updateMetaData({ ...existingMeta, challengeOrder });
164}
165
166async function deleteStepFromMeta({ stepNum }: { stepNum: number }) {
167 const existingMeta = getMetaData();

Callers 3

insertStepFunction · 0.85
createEmptyStepsFunction · 0.85
utils.test.tsFile · 0.85

Calls 2

getMetaDataFunction · 0.85
updateMetaDataFunction · 0.85

Tested by

no test coverage detected