From f929831c9c58a5abce0d9c6bdcbfc25a2b8f391f Mon Sep 17 00:00:00 2001 From: Avdhesh-Varshney <114330097+Avdhesh-Varshney@users.noreply.github.com> Date: Sat, 21 Sep 2024 19:20:52 +0530 Subject: [PATCH] test-3 --- .../app/{(root) => root}/(home)/page.tsx | 0 .../app/{(root) => root}/calendar/page.tsx | 0 .../app/{(root) => root}/layout.tsx | 0 .../{(root) => root}/settings/dsa/page.tsx | 0 .../app/{(root) => root}/settings/layout.tsx | 0 .../app/{(root) => root}/settings/page.tsx | 0 .../advanced/Audio-Analyzer/README.md | 1 - renameFolders.js | 38 +++++++++++++++++++ 8 files changed, 38 insertions(+), 1 deletion(-) rename projects/next-js/advanced/attendance-tracking-app/app/{(root) => root}/(home)/page.tsx (100%) rename projects/next-js/advanced/attendance-tracking-app/app/{(root) => root}/calendar/page.tsx (100%) rename projects/next-js/advanced/attendance-tracking-app/app/{(root) => root}/layout.tsx (100%) rename projects/next-js/advanced/attendance-tracking-app/app/{(root) => root}/settings/dsa/page.tsx (100%) rename projects/next-js/advanced/attendance-tracking-app/app/{(root) => root}/settings/layout.tsx (100%) rename projects/next-js/advanced/attendance-tracking-app/app/{(root) => root}/settings/page.tsx (100%) create mode 100644 renameFolders.js diff --git a/projects/next-js/advanced/attendance-tracking-app/app/(root)/(home)/page.tsx b/projects/next-js/advanced/attendance-tracking-app/app/root/(home)/page.tsx similarity index 100% rename from projects/next-js/advanced/attendance-tracking-app/app/(root)/(home)/page.tsx rename to projects/next-js/advanced/attendance-tracking-app/app/root/(home)/page.tsx diff --git a/projects/next-js/advanced/attendance-tracking-app/app/(root)/calendar/page.tsx b/projects/next-js/advanced/attendance-tracking-app/app/root/calendar/page.tsx similarity index 100% rename from projects/next-js/advanced/attendance-tracking-app/app/(root)/calendar/page.tsx rename to projects/next-js/advanced/attendance-tracking-app/app/root/calendar/page.tsx diff --git a/projects/next-js/advanced/attendance-tracking-app/app/(root)/layout.tsx b/projects/next-js/advanced/attendance-tracking-app/app/root/layout.tsx similarity index 100% rename from projects/next-js/advanced/attendance-tracking-app/app/(root)/layout.tsx rename to projects/next-js/advanced/attendance-tracking-app/app/root/layout.tsx diff --git a/projects/next-js/advanced/attendance-tracking-app/app/(root)/settings/dsa/page.tsx b/projects/next-js/advanced/attendance-tracking-app/app/root/settings/dsa/page.tsx similarity index 100% rename from projects/next-js/advanced/attendance-tracking-app/app/(root)/settings/dsa/page.tsx rename to projects/next-js/advanced/attendance-tracking-app/app/root/settings/dsa/page.tsx diff --git a/projects/next-js/advanced/attendance-tracking-app/app/(root)/settings/layout.tsx b/projects/next-js/advanced/attendance-tracking-app/app/root/settings/layout.tsx similarity index 100% rename from projects/next-js/advanced/attendance-tracking-app/app/(root)/settings/layout.tsx rename to projects/next-js/advanced/attendance-tracking-app/app/root/settings/layout.tsx diff --git a/projects/next-js/advanced/attendance-tracking-app/app/(root)/settings/page.tsx b/projects/next-js/advanced/attendance-tracking-app/app/root/settings/page.tsx similarity index 100% rename from projects/next-js/advanced/attendance-tracking-app/app/(root)/settings/page.tsx rename to projects/next-js/advanced/attendance-tracking-app/app/root/settings/page.tsx diff --git a/projects/vanilla-js/advanced/Audio-Analyzer/README.md b/projects/vanilla-js/advanced/Audio-Analyzer/README.md index c30e38cd..a8b8515b 100644 --- a/projects/vanilla-js/advanced/Audio-Analyzer/README.md +++ b/projects/vanilla-js/advanced/Audio-Analyzer/README.md @@ -10,7 +10,6 @@ ![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white) ![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge&logo=css3&logoColor=white) ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) - diff --git a/renameFolders.js b/renameFolders.js new file mode 100644 index 00000000..8289e84a --- /dev/null +++ b/renameFolders.js @@ -0,0 +1,38 @@ +import fs from 'fs'; +import path from 'path'; + +const baseDir = './projects/'; // Adjust this to your base directory + +const toValidProjectName = (name) => { + return name + .toLowerCase() + .replace(/[^a-z0-9._-]/g, '-') + .replace(/-{2,}/g, '-') + .replace(/^-+|-+$/g, ''); +}; + +const renameDirectories = (dir) => { + fs.readdir(dir, (err, files) => { + if (err) throw err; + + files.forEach((file) => { + const currentPath = path.join(dir, file); + const newName = toValidProjectName(file); + const newPath = path.join(dir, newName); + + if (fs.statSync(currentPath).isDirectory()) { + if (newPath !== currentPath) { + fs.rename(currentPath, newPath, (err) => { + if (err) throw err; + console.log(`Renamed: ${currentPath} to ${newPath}`); + }); + } + // Recursively rename inside subdirectories + renameDirectories(newPath); + } + }); + }); +}; + +// Start renaming from the base directory +renameDirectories(baseDir);