Remove games.txt and replace it with an in-code solution #407
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We would define a game in the
games.txt
file in the following format:id | pretty name for readme | protocol | options | extra
.Storing this data in a file then reading it turned out to be problematic, there has been many cases where this caused issues, such as using this in NextJS (or using bundlers in general), where you would need this hack around it:
This was also inefficient, although it would be read only once (and therefore be lazily loaded), this wasn't exactly a good practice and wouldn't provide any realistic advantages instead of just having them stored in a code file.
One advantage (at least, kind of?) would have been readability, as a game was defined in one line, it was easy to see its properties, but this would get janky with longer lines and not exactly the best for contributors.
This PR removes said game definitions file and replaces it with an in-code solution, in theory it will speed up only the first lookup but reduce memory usage (EDIT: actually not really as I think they would be referenced in said array, not deep copied), as before the game could have been found in 2 places, the
gamesByKey
object and thegames
array (which this one was used just to automatically generate theGAMES_LIST.md
file).