Add logic for content file path generation

This commit is contained in:
Kamran Ahmed
2021-12-03 14:36:31 +01:00
parent 2ec335edc8
commit cdc362625a
5 changed files with 17 additions and 4 deletions

View File

@ -213,6 +213,16 @@ function createDirTree(
return filePaths;
}
// Create directories and get back the paths for created directories
const filePaths = createDirTree(roadmapContentDirPath, dirTree, dirSortOrders);
const contentPathsFilePath = path.join(roadmapDirPath, 'content-paths.json');
fs.writeFileSync(path.join(roadmapDirPath, 'content-paths.json'), JSON.stringify(filePaths, null, 2));
fs.writeFileSync(contentPathsFilePath, JSON.stringify(filePaths, null, 2));
const roadmapMetaFilePath = path.join(roadmapDirPath, 'meta.json');
const roadmapMeta = require(roadmapMetaFilePath);
// Put the content paths file path in the roadmap meta
roadmapMeta.contentPathsFilePath = contentPathsFilePath.replace(CONTENT_DIR, '');
fs.writeFileSync(roadmapMetaFilePath, JSON.stringify(roadmapMeta, null, 2));