spacetime init rewrite#3366
Merged
Merged
Conversation
c022d34 to
ea0f0f7
Compare
ea0f0f7 to
e536cc3
Compare
10f14ee to
cc118cc
Compare
…s/SpacetimeDB into drogus/spacetime-init
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
…s/SpacetimeDB into drogus/spacetime-init
…s/SpacetimeDB into drogus/spacetime-init
jdetter
approved these changes
Oct 30, 2025
Contributor
There was a problem hiding this comment.
I've tested
- Fixed the --server-only bug which prevented generating the module code
- Finished testing the Unity tutorial for both rust and C# modules up to the spacetime generate ... part
- Test Unreal tutorial with both C# and rust up to the spacetime generate ... part
- Fix the issue with Cargo.toml in the rust quickstart
- Test rust module quickstart
- Test C# module quickstart
- Test typescript module quickstart
There are a few code things that I would probably change but I think we can do those as follow-up PRs
cloutiertyler
approved these changes
Oct 30, 2025
Contributor
cloutiertyler
left a comment
There was a problem hiding this comment.
Okay, John and I have thoroughly tested and fixed small bugs. There are two remaining items that are pretty gnarly in this version:
- We scoop up the slop from all over the repo, and we realllllly should change that to be a straightforward copy of future
/templatesdirectory - We need a better gameplan for ensuring that the templates locally depend on SpacetimeDB if you have the repo checked out, but use a package manager/versioning scheme if you copy them as a template. It's pretty slapdash right now, but it kinda works. We should make it better (standardized).
I'm okay to do these things later.
bfops
pushed a commit
that referenced
this pull request
Nov 3, 2025
This is a draft of the new functionality for `spacetime init`. In order to run it with built-in templates you have to set the path to the config file: ``` export SPACETIMEDB_CLI_TEMPLATES_FILE=crates/cli/.init-templates.json ``` In the future it will fetch the list from GH. A few notes: * the previous functionality of `spacetime init` does not work at the moment * the code needs a bit more cleanup and tests before merging * there is a bit of a mix in how we generate empty server and client projects. For Rust we use the existing way of generating. For TypeScript we clone an empty project from the repo. I wanted to play with both ways of doing things, and I'm still not sure which is better. Generation in Rust means that the generated code will match the CLI version and not necessarily whatever is in Git. On the other hand, for the builtin templates we will be fetching the newest version from GH, which I guess might also not what we want, ie. we probably want only stable templates. More discussion is needed here * we use `spacetimedb` directory for the server files * I don't particularly like the inability to disable interactive mode easily. We discussed disabling it by default if all of the required arguments are passed, but I don't think it's feature proof. For example, if someone relies on a non-interactive mode, and we add a new required argument, instead of printing a message `missing --foo`, we will automatically launch interactive mode, which is harder to debug. That's why I think I'd prefer to implement `--non-interactive` argument * it's kind of hard to keep the legacy behaviour. If you don't pass any arguments, we go into interactive mode. In the legacy version, we would print required arguments. If someone passes `--lang` or `--project-path` explicitly, I guess we could run the legacy workflow, but not sure if it's worth it, as the command was marked as unstable anyway * the project path defaults to the project name, but I think we should probably replace change whitespaces to dashes, or at least ask for the project path with the project name being the default (or both) --------- Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com> Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com> Co-authored-by: = <cloutiertyler@gmail.com> Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com> Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com> Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
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.
This is a draft of the new functionality for
spacetime init. In order to run it with built-in templates you have to set the path to the config file:In the future it will fetch the list from GH.
A few notes:
spacetime initdoes not work at the momentspacetimedbdirectory for the server filesmissing --foo, we will automatically launch interactive mode, which is harder to debug. That's why I think I'd prefer to implement--non-interactiveargument--langor--project-pathexplicitly, I guess we could run the legacy workflow, but not sure if it's worth it, as the command was marked as unstable anyway