feat: create mobile curriculum data on build (#45162)

* feat: create mobile curriculum data on build

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Sem Bauke
2022-03-01 15:59:15 +01:00
committed by GitHub
parent 86a470ef1a
commit e8ec209431
3 changed files with 51 additions and 1 deletions

View File

@@ -2,11 +2,18 @@ const fs = require('fs');
const path = require('path');
const { getChallengesForLang } = require('../../../curriculum/getChallenges');
const { buildMobileCurriculum } = require('./build-mobile-curriculum');
const globalConfigPath = path.resolve(__dirname, '../../../config');
// We are defaulting to English because the ids for the challenges are same
// across all languages.
getChallengesForLang('english')
.then(result => {
buildMobileCurriculum(result);
return result;
})
.then(JSON.stringify)
.then(x => fs.writeFileSync(`${globalConfigPath}/curriculum.json`, x));
.then(json => {
fs.writeFileSync(`${globalConfigPath}/curriculum.json`, json);
});