Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Constants cleanup #4264

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

[Refactor] Constants cleanup #4264

wants to merge 17 commits into from

Conversation

arielj
Copy link
Collaborator

@arielj arielj commented Jan 11, 2025

The backend/constants.ts file was getting out of hands since a long time ago, it was a bucket to put things from all types, paths, urls, helper booleans, it also did initialization of the logger, had some helper functions related to steam, it was a long and complicated file.

This also created problems when wanting to import one thing from that file could lead into issues with the file doing unexpected things.

This PR splits the file into different concerns and also moves some constants to other places where they make more sense:

  • store related paths where moved into storeManagers/<store>/constants.ts, so all gog paths are next to the gog file, nile paths next to the nile paths, etc
  • some constants where only used in one single place, like the anticheat json location, or the vulkan helper location, images cache path, etc, those were moved to the places they are used instead
  • I divided the constants in different groups: paths, urls, environment (all the isXyz booleans), key_value_stores for the electron stores (I think these can be moved somewhere else though), and others (to collect some things I didn't know where to put)
  • I also took the opportunity to rename some constants: some where related to legendary but were too generic like installed (renamed to legendaryInstalled), or flatPakHome renamed as flatpakHome
  • I added a new const isAppImage that could be useful in the future
  • I also moved all the logger constants (and initialization) to happen in the initLogger module, makes more sense there

I can split this into smaller PRs if it's easier to check and test, but I think the changes are pretty repetitive through all the files, just changing imports in most of them.


Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@arielj arielj added the pr:ready-for-review Feature-complete, ready for the grind! :P label Jan 11, 2025
@arielj arielj requested review from Etaash-mathamsetty, a team, flavioislima, CommandMC, Nocccer and imLinguin and removed request for a team January 11, 2025 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant