Files
freeCodeCamp/tools/scripts/build/build-curriculum.ts
Sem Bauke d5423745d9 chore(tools): update filename and versioning API (#46238)
* chore(tools): update filename and versioning API

* fix(tests): rename file name

* fix(tests): current version to test against
2022-05-31 09:57:36 +02:00

27 lines
757 B
TypeScript

import fs from 'fs';
import path from 'path';
import { getChallengesForLang } from '../../../curriculum/getChallenges';
import {
buildExtCurriculumData,
Curriculum
} 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);
}
return result;
})
.then(JSON.stringify)
.then(json => {
fs.writeFileSync(`${globalConfigPath}/curriculum.json`, json);
});