fix: use keys in curriculum.json (#45407)

* feat: add function to map from path to superblock

* fix: use superblocks as keys in curriculum.json

* fix: handle new superblock names

* fix: keep deleting relational-database
This commit is contained in:
Oliver Eyton-Williams
2022-03-10 21:41:33 +01:00
committed by GitHub
parent f485bc1c16
commit 8ee9b5761a
6 changed files with 97 additions and 17 deletions

View File

@ -9,7 +9,7 @@ exports.buildMobileCurriculum = function buildMobileCurriculum(json) {
function writeAndParseCurriculumJson(curriculum) {
const superBlockKeys = Object.keys(curriculum).filter(
key => key !== '00-certifications'
key => key !== 'certifications'
);
writeToFile('availableSuperblocks', { superblocks: superBlockKeys });
@ -34,9 +34,8 @@ exports.buildMobileCurriculum = function buildMobileCurriculum(json) {
}
function writeToFile(filename, json) {
fs.writeFileSync(
`${mobileStaticPath}/mobile/${filename}.json`,
JSON.stringify(json, null, 2)
);
const fullPath = `${mobileStaticPath}/mobile/${filename}.json`;
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
fs.writeFileSync(fullPath, JSON.stringify(json, null, 2));
}
};