Skip to content

Commit b2cee93

Browse files
droguscloutiertylerjdetter
authored
New command: spacetime dev (#3469)
# Description of Changes This PR implements a new command for the CLI: `spacetime dev`. If run from outside of a project directory, it will call `init` in interactive mode to allow user to create a project. If run from a project directory, it will ask for a module to conect to and it will: * subscribe to logs * observe files in the `spacetimedb` directory and automatically publish to SpacetimeDB One caveat is that instead of reusing the `logs` code I did some repetition cause currently the logs code acquires a lock that lives through await points. It is fixable, but due to limited time I decided to go with a bit of code duplication. It shouldn't be very hard to fix later, though. --------- Signed-off-by: Tyler Cloutier <[email protected]> Signed-off-by: John Detter <[email protected]> Co-authored-by: = <[email protected]> Co-authored-by: Tyler Cloutier <[email protected]> Co-authored-by: Tyler Cloutier <[email protected]> Co-authored-by: John Detter <[email protected]>
1 parent e8c946e commit b2cee93

File tree

18 files changed

+787
-40
lines changed

18 files changed

+787
-40
lines changed

.env.sample

Lines changed: 0 additions & 2 deletions
This file was deleted.

Cargo.lock

Lines changed: 67 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ lazy_static = "1.4.0"
207207
log = "0.4.17"
208208
memchr = "2"
209209
mimalloc = "0.1.39"
210+
names = "0.14"
210211
nohash-hasher = "0.2"
212+
notify = "7.0"
211213
nix = "0.30"
212214
once_cell = "1.16"
213215
parking_lot = { version = "0.12.1", features = ["send_guard", "arc_lock"] }

crates/cli/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ wasmbin.workspace = true
7575
webbrowser.workspace = true
7676
clap-markdown.workspace = true
7777
git2.workspace = true
78-
dialoguer.workspace = true
78+
dialoguer = { workspace = true, features = ["fuzzy-select"] }
7979
rolldown.workspace = true
8080
rolldown_utils.workspace = true
8181
xmltree.workspace = true
8282
quick-xml.workspace = true
83+
names.workspace = true
84+
notify.workspace = true
8385

8486
[target.'cfg(not(target_env = "msvc"))'.dependencies]
8587
tikv-jemallocator = { workspace = true }

crates/cli/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ impl RawConfig {
169169
ecdsa_public_key: None,
170170
};
171171
RawConfig {
172-
default_server: local.nickname.clone(),
173-
server_configs: vec![local, maincloud],
172+
default_server: maincloud.nickname.clone(),
173+
server_configs: vec![maincloud, local],
174174
web_session_token: None,
175175
spacetimedb_token: None,
176176
}

crates/cli/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub fn get_subcommands() -> Vec<Command> {
2525
logs::cli(),
2626
call::cli(),
2727
describe::cli(),
28+
dev::cli(),
2829
energy::cli(),
2930
sql::cli(),
3031
dns::cli(),
@@ -51,6 +52,7 @@ pub async fn exec_subcommand(
5152
match cmd {
5253
"call" => call::exec(config, args).await,
5354
"describe" => describe::exec(config, args).await,
55+
"dev" => dev::exec(config, args).await,
5456
"energy" => energy::exec(config, args).await,
5557
"publish" => publish::exec(config, args).await,
5658
"delete" => delete::exec(config, args).await,

0 commit comments

Comments
 (0)