diff --git a/src/update_db.py b/src/update_db.py index a35e177bd7a7..bdf0917dd936 100644 --- a/src/update_db.py +++ b/src/update_db.py @@ -305,6 +305,10 @@ def _add_platform_game_counts(full_dict: dict) -> None: """ Calculate and attach game counts to each platform, then rewrite platforms/all.json. + The ``games`` list (appended by :func:`_append_related_items`) is intentionally excluded from + the ``all.json`` summary file because it would make the file excessively large. The full game + list is still available in each individual platform JSON file. + Parameters ---------- full_dict : dict @@ -314,8 +318,14 @@ def _add_platform_game_counts(full_dict: dict) -> None: for platform_data in full_dict['platforms'].values(): platform_data['game_count'] = len(platform_data.get('games', [])) + # Write a lightweight all.json that omits the 'games' list so the file stays small enough + # to be hosted on GitHub Pages (< 100 MB limit). + summary_data = { + pid: {k: v for k, v in pdata.items() if k != 'games'} + for pid, pdata in full_dict['platforms'].items() + } file_path = os.path.join(args.out_dir, 'platforms', 'all') - write_json_files(file_path=file_path, data=full_dict['platforms']) + write_json_files(file_path=file_path, data=summary_data) def _build_buckets_and_collect_videos(full_dict: dict) -> tuple: diff --git a/tests/unit/test_update_db.py b/tests/unit/test_update_db.py index ee1b2b5f42e0..d4845d3cf7ab 100644 --- a/tests/unit/test_update_db.py +++ b/tests/unit/test_update_db.py @@ -271,6 +271,12 @@ def test_add_platform_game_counts(tmp_path): assert full_dict['platforms'][6]['game_count'] == 2 assert full_dict['platforms'][48]['game_count'] == 0 mock_write.assert_called_once() + # Verify the 'games' list is excluded from the summary written to all.json + written_data = mock_write.call_args.kwargs['data'] + assert 'games' not in written_data[6] + assert 'games' not in written_data[48] + assert written_data[6]['game_count'] == 2 + assert written_data[6]['name'] == 'PC' @pytest.mark.parametrize('name,expected_bucket', [