mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-27 02:54:27 +02:00
chore: upgrade dependencies (#8468)
* Upgrade paths * Update topic rendering * Fix file names * Remove courses file
This commit is contained in:
58
scripts/rename-content.ts
Normal file
58
scripts/rename-content.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const roadmapDirs = fs.readdirSync(
|
||||
path.join(__dirname, '..', 'src', 'data', 'roadmaps'),
|
||||
);
|
||||
|
||||
roadmapDirs.forEach((roadmapDir) => {
|
||||
const roadmapDirPath = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'src',
|
||||
'data',
|
||||
'roadmaps',
|
||||
roadmapDir,
|
||||
'content',
|
||||
);
|
||||
|
||||
const roadmapDirContent = fs.readdirSync(roadmapDirPath);
|
||||
|
||||
roadmapDirContent.forEach((content) => {
|
||||
const contentPath = path.join(roadmapDirPath, content);
|
||||
const contentStats = fs.statSync(contentPath);
|
||||
|
||||
const oldName = path.basename(contentPath);
|
||||
const newName = oldName.replace(/^(\d+)-/, '');
|
||||
|
||||
fs.renameSync(contentPath, path.join(roadmapDirPath, newName));
|
||||
|
||||
if (contentStats.isDirectory()) {
|
||||
const contentDirContent = fs.readdirSync(contentPath);
|
||||
|
||||
contentDirContent.forEach((contentDir) => {
|
||||
const contentDirPath = path.join(contentPath, contentDir);
|
||||
const contentDirStats = fs.statSync(contentDirPath);
|
||||
|
||||
const oldName = path.basename(contentDirPath);
|
||||
const newName = oldName.replace(/^(\d+)-/, '');
|
||||
|
||||
fs.renameSync(contentDirPath, path.join(contentPath, newName));
|
||||
|
||||
if (contentDirStats.isDirectory()) {
|
||||
const contentDirContent = fs.readdirSync(contentDirPath);
|
||||
|
||||
contentDirContent.forEach((contentDir) => {
|
||||
const contentDirPath2 = path.join(contentDirPath, contentDir);
|
||||
const contentDirStats2 = fs.statSync(contentDirPath2);
|
||||
|
||||
const oldName2 = path.basename(contentDirPath2);
|
||||
const newName2 = oldName2.replace(/^(\d+)-/, '');
|
||||
|
||||
fs.renameSync(contentDirPath2, path.join(contentDirPath, newName2));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user