Skip to content

Thunderstore ecosystem integration #1724

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

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from
Draft

Conversation

anttimaki
Copy link
Collaborator

@anttimaki anttimaki commented Apr 16, 2025

Use Thunderstore ecosystem as the source of truth for game definitions.

PR contents:

  • First commit: ethangreen-dev's earlier work rebased on top of the current develop branch
  • Third commit: add tooling for updating the local ecosystem files
  • Fourth commit: switch to using "live" data instead of the hardcoded files included in the first commit
  • Rest of the commits change the code to use the information provided by the ecosystem, add/fix methods for mapping the ecosystem data to values used by the mod manager, and clean up implementation where it's made possible by the improved typing and more complete ecosystem data

Mod manager TODO:

Ecosystem TODO:

  • Required: Ecosystem data contains outdated iconUrl for R.E.P.O.
  • Required: update schema to contain PackageLoader.None and latest games
  • Optional: Provide information for dedicated servers
  • Optional: Provide game images as URLs rather than filenames
  • Optional: Consider providing package loader's RecommendedVersion information
  • Optional: Provide package installer information


export const ALL_MODLOADER_MAPPINGS = [
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is it safe to drop these exports already?

ethangreen-dev and others added 10 commits April 29, 2025 18:24
This commit and PR largely aim to replace previously hard-coded game and
mod definitions within R2MM with data read directly from the
ecosystem schema (thunderstore-io/ecosystem-schema).

Validation is accomplished through ajv, which allows us to validate the
provided ecosystem-schema document with its cooresponding JSON schema
(ecosystem.json and ecosystemJsonSchema.json).
Null can be used as an empty value. The change is done to be consistent
with how Thunderstore ecosystem defines the value to avoid unnecessary
casting.

Game specific install rules can be removed later when the mod manager
uses the information provided by the ecosystem.
- As the Thunderstore API endpoint now contains more data, the file
  it's stored in was renamed from games.json to ecosystem.json
- Thunderstore API now provides an endpoint for JSON Schema file that
  can be used to validate the data
- quicktype is used to generate TypeScript type definitions based on
  the JSON Schema file
Drop the hardcoded ecosystem data and schema files used in prototyping
phase. Instead, use the files that can be refreshed with the sync
script included in the repo.

Use the TypeScript types generated based on the JSON Schema to make the
typing more exact and e.g. allows dropping some type casting elsewhere
on the codebase. This also improves the perceived performance in IDE
since the types inferred based on the data could contain thousands of
alternative types for some objects.

The quicktype library that's used to generate the types could in theory
be used to also validate the data via the Convert class available in
the type file. However, the error messages it provides are completely
useless in debugging the problem, so ajv library is still used even
though it adds another dependency.
- Map tracking method strings from ecosystem data to the types used in
  the mod manager
- Include relativeFileExclusions in the code now that they are
  available in the ecosystem data

Mediate differences between ecosystem data
Since the ecosystem data is now more complete and the typing more
exact, it's also possible to simplify the implementation.
Since the typing is now more exact, it's possible to also simplify the
implementation.
Each game can now have an array of R2Modman items instead of just one.
Each R2Modman item is now self-sufficient, i.e. thay contain the meta
and distribution information of the game.

This allows supporting different editions of a game (Outward vs
Outward Definitive Edition) and dedicated servers without changing the
ecosystem data structure too much.
@anttimaki anttimaki force-pushed the ecosystem-integration branch from 2fe840b to 033b802 Compare April 30, 2025 11:46
const ECOSYSTEM_JSON_SCHEMA_URL = "https://thunderstore.io/api/experimental/schema/ecosystem-json-schema/latest/";
const ECOSYSTEM_DATA_PATH = "./src/assets/data/ecosystem.json";
const ECOSYSTEM_JSON_SCHEMA_PATH = "./src/assets/data/ecosystemJsonSchema.json";
const ECOSYSTEM_DATA_TYPES_PATH = "./src/assets/data/ecosystem.d.ts";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm considering changing this from ecosystem.d.tsto something likeecosystemTypes.ts` so Enums can be imported instead of having to be redefined in the mod manager.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is now done in #1751

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants