mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-07 09:03:27 -05:00
19 lines
493 B
TypeScript
19 lines
493 B
TypeScript
import fs from 'fs/promises';
|
|
|
|
import curriculum from '../shared/config/curriculum.json';
|
|
|
|
interface Curriculum {
|
|
[key: string]: unknown;
|
|
}
|
|
const typedCurriculum = curriculum as Curriculum;
|
|
|
|
const patchedCurriculum = Object.keys(typedCurriculum).reduce((acc, key) => {
|
|
return { ...acc, [key.replace(/\//g, '-')]: typedCurriculum[key] };
|
|
}, {});
|
|
|
|
void fs
|
|
.mkdir('data', { recursive: true })
|
|
.then(() =>
|
|
fs.writeFile('./data/curriculum.json', JSON.stringify(patchedCurriculum))
|
|
);
|