refactor: unify duplicate project registries into a shared projects database#985
Conversation
|
@nishtha-agarwal-211 is attempting to deploy a commit to the Anuj's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR centralizes the project catalog into a single projects_registry.json file and updates both the web progress tracker and Python utilities to read from that registry, including migrations for renamed project folders.
Changes:
- Added a root
projects_registry.jsonregistry and updated consumers to load projects dynamically from it. - Updated the web progress tracker to fetch the registry and migrate legacy localStorage completion keys.
- Updated the Python Progress Tracker (and
search_projects.py) to load the registry from JSON rather than hardcoded lists.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| web-app/projects_registry.json | Attempts to expose the root registry to the web app (currently via a non-JSON stub). |
| web-app/js/projects/progress-tracker.js | Loads registry via fetch, renders categories dynamically, and migrates old completion keys. |
| utilities/Progress-Tracker/Progress-Tracker.py | Loads registry from JSON and migrates persisted completion keys. |
| search_projects.py | Replaces inline registry definition with JSON loading (but removes most of the script). |
| projects_registry.json | Adds the centralized registry used by multiple tools. |
Comments suppressed due to low confidence (1)
web-app/projects_registry.json:1
progress-tracker.jscallsfetch('./projects_registry.json').then(r => r.json()), but this file is not valid JSON (it’s a plain string path), so parsing will fail at runtime. Makeweb-app/projects_registry.jsonan actual JSON file (e.g., copy of the root registry as part of build/deploy) or change the fetch path to point to the real JSON location that the web server serves (and ensure that endpoint returns JSON).
[
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const catTitle = document.createElement('div'); | ||
| catTitle.className = 'pt-cat-title'; | ||
| catTitle.innerHTML = cat + ' · ' + catDone + '/' + projects.length; |
| const card = document.createElement('div'); | ||
| card.className = 'pt-card' + (isDone ? ' done' : ''); | ||
| card.innerHTML = '<span class="pt-tick">' + (isDone ? '✅' : '⬜') + '</span><span class="pt-name">' + name + '</span>'; |
| function render() { | ||
| const done = load(); | ||
| const count = done.length; | ||
| const pct = Math.round((count / TOTAL) * 100); |
| for k, v in completed.items(): | ||
| if k in migrations: | ||
| updated_completed[migrations[k]] = v | ||
| mutated = True | ||
| else: | ||
| updated_completed[k] = v |
| try: | ||
| with open(REGISTRY_PATH, "r", encoding="utf-8") as f: | ||
| registry = json.load(f) |
| except Exception as e: | ||
| print(f"Error loading project registry: {e}") | ||
|
|
||
| # Flatten for quick lookup | ||
| ALL_PROJECT_NAMES = [p for projects in ALL_PROJECTS.values() for p in projects] | ||
| TOTAL = len(ALL_PROJECT_NAMES) |
| REGISTRY_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "projects_registry.json") | ||
|
|
||
| try: | ||
| with open(REGISTRY_PATH, "r", encoding="utf-8") as f: | ||
| PROJECTS = json.load(f) | ||
| except Exception as e: | ||
| print(f"Error loading project registry: {e}") | ||
| PROJECTS = [] | ||
|
|
||
| DIFFICULTY_ORDER = {"beginner": 1, "intermediate": 2, "advanced": 3} |
|
🎉 Thank you for your contribution! Your Pull Request has been merged successfully. We appreciate the time and effort you put into improving this project. Contributions like yours help the repository grow and stay useful for everyone. If you'd like to contribute again, please check the open issues and make sure you are assigned before opening another Pull Request. Thanks again for your support! 🙌 |
Description
This Pull Request addresses issue #979 by refactoring duplicate, hardcoded project lists across several files into a single, unified project registry database. This ensures consistency and makes it much easier to add or update mini-projects in the future without duplicating files or lists.
Fixes #979
Proposed Changes
Central JSON Registry Database:
projects_registry.jsonat the root of the project to act as the single source of truth.name,emoji,category,difficulty,description,keywords, andpath.web-app/projects_registry.jsonpointing to../projects_registry.jsonto allow the static Web App to resolve the JSON locally.Refactored CLI Search (
search_projects.py):PROJECTSlist with a dynamic load using thejsonmodule.NameErroron script exit.Refactored CLI Progress Tracker (
utilities/Progress-Tracker/Progress-Tracker.py):projects_registry.json.games -> 🎲 Games,math -> 🔢 Math,utilities -> 🔐 Utilities).path(e.g.Rock-Paper-Scissor).load_data()to seamlessly map legacy tracker keys (Dice-Rolling,Coin-Flip,Pascals-Triangle) to the new unified folder names (Roling-Dice,Flipping-toss,Pascal-Triangle).Refactored Web App Progress Tracker (
web-app/js/projects/progress-tracker.js):./projects_registry.jsonrelative to the app.