1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-29 03:59:54 +02:00

Rearrange JSON files

This commit is contained in:
Kamran Ahmed
2023-01-18 19:47:47 +04:00
parent 89a436a5b7
commit 8f8e2f41d8
61 changed files with 36 additions and 30 deletions

View File

@@ -2,13 +2,18 @@ const fs = require('node:fs');
const path = require('node:path');
const jsonsDir = path.join(process.cwd(), 'public/jsons');
const jsonFiles = fs.readdirSync(jsonsDir);
const childJsonDirs = fs.readdirSync(jsonsDir);
jsonFiles.forEach((jsonFileName) => {
console.log(`Compressing ${jsonFileName}...`);
childJsonDirs.forEach((childJsonDir) => {
const fullChildJsonDirPath = path.join(jsonsDir, childJsonDir);
const jsonFiles = fs.readdirSync(fullChildJsonDirPath);
const jsonFilePath = path.join(jsonsDir, jsonFileName);
const json = require(jsonFilePath);
jsonFiles.forEach((jsonFileName) => {
console.log(`Compressing ${jsonFileName}...`);
fs.writeFileSync(jsonFilePath, JSON.stringify(json));
const jsonFilePath = path.join(fullChildJsonDirPath, jsonFileName);
const json = require(jsonFilePath);
fs.writeFileSync(jsonFilePath, JSON.stringify(json));
});
});

View File

@@ -82,7 +82,7 @@ function prepareDirTree(control, dirTree, dirSortOrders) {
return { dirTree, dirSortOrders };
}
const roadmap = require(path.join(__dirname, `../public/jsons/${roadmapId}`));
const roadmap = require(path.join(__dirname, `../public/jsons/roadmaps/${roadmapId}`));
const controls = roadmap.mockup.controls.control;
// Prepare the dir tree that we will be creating and also calculate the sort orders