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

explore writing config output to strongly typed json file #2925

Open
holic opened this issue Jul 4, 2024 · 0 comments
Open

explore writing config output to strongly typed json file #2925

holic opened this issue Jul 4, 2024 · 0 comments

Comments

@holic
Copy link
Member

holic commented Jul 4, 2024

In playing with manifests and generating metadata files from config + filesystem state, we found that we could maybe resolve some issues/complexity around TS by writing config output to a strongly typed JSON file. This has a few nice side effects:

  • we don't need to duplicate logic between JS runtime + TS types, instead the output is just JS runtime written to a file (and made strongly typed with our .json.d.ts approach)
  • we get a platform-agnostic representation of the MUD config that can be used outside TS tooling
  • we can combine data read from filesystem into the input (i.e. systems), where before this is impossible due to config output being used in the client where the filesystem is not accessible
  • we could separate out things that are irrelevant to the app's runtime (codegen options, deploy options) into their own files that don't need strong types

Biggest downsides at the moment are

  • we add a build step between writing a config and using it downstream.
  • we're limited to values being JSON serializable, so we can't encode things like functions, references, etc. (but we don't use this at the moment anyway)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant