mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-05 12:06:36 -05:00
* feat(client): generate challenge data as static files * chore: hopefully this is better types * fix: add declaration file * fix: schema issues --------- Co-authored-by: sembauke <semboot699@gmail.com>
28 lines
794 B
TypeScript
28 lines
794 B
TypeScript
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
import { getChallengesForLang } from '../../../curriculum/get-challenges';
|
|
import {
|
|
buildExtCurriculumData,
|
|
Curriculum,
|
|
CurriculumProps
|
|
} from './build-external-curricula-data';
|
|
|
|
const { CURRICULUM_LOCALE } = process.env;
|
|
|
|
const globalConfigPath = path.resolve(__dirname, '../../../config');
|
|
|
|
// We are defaulting to English because the ids for the challenges are same
|
|
// across all languages.
|
|
void getChallengesForLang('english')
|
|
.then((result: Record<string, unknown>) => {
|
|
if (CURRICULUM_LOCALE === 'english') {
|
|
buildExtCurriculumData('v1', result as Curriculum<CurriculumProps>);
|
|
}
|
|
return result;
|
|
})
|
|
.then(JSON.stringify)
|
|
.then(json => {
|
|
fs.writeFileSync(`${globalConfigPath}/curriculum.json`, json);
|
|
});
|