Open
Conversation
- Add --client-command flag to specify client dev command - Add --server-only flag to skip client execution - Add spacetime.toml config file for project settings - Auto-detect client command from package.json/Cargo.toml/.csproj - Save detected command to spacetime.toml for future runs - Update spacetime init to set default client command - Add spacetime.toml to all templates with appropriate defaults - Update documentation
- Add --client-command flag to specify client dev command - Add --server-only flag to skip client execution - Add spacetime.toml config file for project settings - Auto-detect client command from package.json/Cargo.toml/.csproj - Save detected command to spacetime.toml for future runs - Update spacetime init to set default client command - Add spacetime.toml to all templates with appropriate defaults - Update documentation
….com/clockworklabs/SpacetimeDB into feature/spacetime-dev-client-command
- Client environment variables: The dev command now sets SPACETIMEDB_DB_NAME and SPACETIMEDB_HOST environment variables when spawning the client process. This fixes Rust and C# clients which read these env vars to determine which database to connect to. Previously, they would fall back to hardcoded defaults (e.g., quickstart-chat) and fail to connect. - C# module file watching: The file watcher now correctly handles C# modules which have source files directly in spacetimedb/ rather than in spacetimedb/src/. Previously, watching spacetimedb/src/ would fail with "Input watch path is neither a file nor a directory" for C# projects.
…mand' into drogus/spacetime-json
* Don't overwrite existing config if there is any * Fail to parse the file if there are unknown fields present
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Changes
This PR implements support for the
spacetime.jsonconfiguration file that can be used to set up commongenerateandpublishtargets. An example ofspacetime.jsoncould look like this:With this config, running
spacetime generatewithout any arguments would generate bindings for two targets:region-moduleandglobal-module.spacetime publishwithout any arguments would publish three modules, starting from the parent:bitcraft,region-1, andregion-2. On top of that, the commandpnpm devwould be executed when usingspacetime dev.It is also possible to pass additional command line arguments when calling the
publishandgeneratecommands, but there are certain limitations. There is a special case when passing either a module path to generate or a module name to publish. Doing that will filter out entries in the config file that do not match. For example, running:would only generate bindings for the second entry in the
generatelist.In a similar fashion, running:
would only publish the child database with the name
region-1Passing other existing arguments is also possible, but not all of the arguments are available for multiple configs. For example, when running
spacetime publish --server maincloud, the publish command would be applied to all of the modules listed in the config file, but theservervalue from the command line arguments would take precedence. Running with arguments like--bin-pathwould, however, would throw an error as--bin-pathmakes sense only in a context of a specific module, thus this wouldn't work:spacetime publish --bin-path spacetimedb/target/debug/bitcraft.wasm. I will throw an error unless there is only one entry to process, thusspacetime publish --bin-path spacetimedb/target/debug/bitcraft.wasm bitcraftwould work, as it filters the publish targets to one entry.API and ABI breaking changes
None
Expected complexity level and risk
3
The config file in itself is not overly complex, but when coupled with the CLI it is somewhat tricky to get right. There are also some changes that I had to make to how clap arguments are validated - because the values can now come from both the config file and the clap config, we can't use some of the built-in validations like
required, or at least I haven't found a clean way to do so.Testing
I've added some automated tests, but more tests and manual testing is coming.