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

Function updateIntroJson

tools/challenge-helper-scripts/create-quiz.ts:47–66  ·  view source on GitHub ↗
(
  superBlock: SuperBlocks,
  block: string,
  title: string
)

Source from the content-addressed store, hash-verified

45}
46
47async function updateIntroJson(
48 superBlock: SuperBlocks,
49 block: string,
50 title: string
51) {
52 const introJsonPath = path.resolve(
53 __dirname,
54 '../../client/i18n/locales/english/intro.json'
55 );
56 const newIntro = await parseIntroJson(introJsonPath);
57 newIntro[superBlock].blocks[block] = {
58 title,
59 intro: ['', '']
60 };
61 void withTrace(
62 fs.writeFile,
63 introJsonPath,
64 await format(JSON.stringify(newIntro), { parser: 'json' })
65 );
66}
67
68async function createMetaJson(
69 block: string,

Callers 1

createQuizFunction · 0.70

Calls 3

parseIntroJsonFunction · 0.90
withTraceFunction · 0.85
formatFunction · 0.50

Tested by

no test coverage detected