clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.41k stars 110 forks source link

Include project language in project config #1975

Open bfops opened 2 weeks ago

bfops commented 2 weeks ago

Currently, spacetime publish detects language by searching for Cargo.toml, and assuming the absence means we’re in a C# project. This is bad, because it means if you run spacetime publish in a directory that isn’t either a C# or Rust project, we’ll try to compile it as C#, which will fail with a bad error message.

One way to avoid this is to require that modules include a Spacetime config file (.spacetime.toml or spacetime.toml), and include the project language in that config file.

For good DX, this will require automatically creating a config file in spacetime init, and a good error message from spacetime publish if the config file is not found. The error message should describe how to create a config file, ideally including a snippet that the user can paste into their shell to create the config file.