Skip to content

Bundles file size improvements#3832

Merged
Martí Climent (marticliment) merged 4 commits into
mainfrom
json-bundles-improvements
Jul 9, 2025
Merged

Bundles file size improvements#3832
Martí Climent (marticliment) merged 4 commits into
mainfrom
json-bundles-improvements

Conversation

@marticliment
Copy link
Copy Markdown
Collaborator

@marticliment Martí Climent (marticliment) commented Jul 9, 2025

Improvements to bundle save file size. So far, ~300K -> ~100K

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors serialization to produce more compact JSON, replaces specific key prefixes, and disables indented output to reduce bundle file size from ~300 KB to ~70 KB.

  • Updated backup key delimiters in GitHubBackupService
  • Introduced AsJsonNode overrides across serializable classes and switched AsJsonString to minify JSON
  • Disabled WriteIndented in SerializationHelpers

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

File Description
src/UniGetUI/Services/GitHubBackupService.cs Changed backup key markers from #[…] to @[…]
src/UniGetUI/Pages/SoftwarePages/PackageBundlesPage.cs Swapped JsonSerializer.Serialize(...) for AsJsonString()
Serializable* files in UniGetUI.PackageEngine.Serializable Added AsJsonNode implementations for all serializable types
src/UniGetUI.Core.Tools/SerializationHelpers.cs Set WriteIndented = false to disable pretty JSON
Comments suppressed due to low confidence (3)

src/UniGetUI.PackageEngine.Serializable/SerializableComponent.cs:27

  • [nitpick] Add unit tests for AsJsonNode and AsJsonString to verify that serialized output is correct and remains compact after these refactorings.
        return JsonSerializer.Serialize(AsJsonNode(), SerializationHelpers.DefaultOptions);

src/UniGetUI.PackageEngine.Serializable/InstallOptions.cs:60

  • The initializer = [] is invalid for a List. Replace with = new List<string>() or a valid collection expression.
        public List<string> KillBeforeOperation { get; set; } = [];

src/UniGetUI/Services/GitHubBackupService.cs:9

  • If any code or regex matches the old #[…] pattern, it must be updated to the new @[…] prefix to avoid lookup failures.
        private const string GistDescription_EndingKey = "@[UNIGETUI_BACKUP_V1]";

Comment thread src/UniGetUI.PackageEngine.Serializable/SerializableBundle.cs
Comment thread src/UniGetUI.PackageEngine.Serializable/InstallOptions.cs
Comment thread src/UniGetUI.PackageEngine.Serializable/InstallOptions.cs
@marticliment Martí Climent (marticliment) marked this pull request as ready for review July 9, 2025 22:20
@marticliment Martí Climent (marticliment) merged commit 27184e1 into main Jul 9, 2025
2 checks passed
@marticliment Martí Climent (marticliment) deleted the json-bundles-improvements branch July 18, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants