Skip to content

Commit

Permalink
refactor: move cli args to separate crates (#2681)
Browse files Browse the repository at this point in the history
* refactor: move cli args to separate crates

* move node args methods to katana-cli crate as well

* fix: add missing derive and conversion to config file

* remove silent arg

* create directory for db dir torii

* move to new module

* rename node -> args

* dont re-export node config file

* fmt

---------

Co-authored-by: Ammar Arif <[email protected]>
Co-authored-by: Nasr <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent c16f3c9 commit cbdd2f0
Show file tree
Hide file tree
Showing 20 changed files with 805 additions and 585 deletions.
64 changes: 47 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ members = [
"crates/katana/storage/provider",
"crates/katana/tasks",
"crates/katana/trie",
"crates/katana/cli",
"crates/metrics",
"crates/saya/core",
"crates/saya/provider",
Expand All @@ -46,6 +47,7 @@ members = [
"crates/torii/client",
"crates/torii/server",
"crates/torii/types-test",
"crates/torii/cli",
"examples/spawn-and-move",
"scripts/verify_db_balances",
"xtask/generate-test-db",
Expand Down Expand Up @@ -104,6 +106,7 @@ katana-runner = { path = "crates/katana/runner" }
katana-slot-controller = { path = "crates/katana/controller" }
katana-tasks = { path = "crates/katana/tasks" }
katana-trie = { path = "crates/katana/trie" }
katana-cli = { path = "crates/katana/cli" }

# torii
torii-client = { path = "crates/torii/client" }
Expand All @@ -112,6 +115,7 @@ torii-graphql = { path = "crates/torii/graphql" }
torii-grpc = { path = "crates/torii/grpc" }
torii-relay = { path = "crates/torii/libp2p" }
torii-server = { path = "crates/torii/server" }
torii-cli = { path = "crates/torii/cli" }

# saya
saya-core = { path = "crates/saya/core" }
Expand Down
21 changes: 3 additions & 18 deletions bin/katana/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,23 @@ repository.workspace = true
version.workspace = true

[dependencies]
katana-core.workspace = true
katana-cli.workspace = true
katana-db.workspace = true
katana-node.workspace = true
katana-primitives.workspace = true
katana-slot-controller = { workspace = true, optional = true }

alloy-primitives.workspace = true
anyhow.workspace = true
byte-unit = "5.1.4"
cainome-cairo-serde.workspace = true
clap.workspace = true
clap_complete.workspace = true
comfy-table = "7.1.1"
console.workspace = true
dojo-utils.workspace = true
serde.workspace = true
serde_json.workspace = true
shellexpand = "3.1.0"
tokio.workspace = true
toml.workspace = true
tracing.workspace = true
tracing-log.workspace = true
tracing-subscriber.workspace = true
url.workspace = true

[dev-dependencies]
assert_matches.workspace = true
starknet.workspace = true

[features]
default = [ "jemalloc", "slot" ]
default = [ "jemalloc", "katana-cli/slot" ]

jemalloc = [ ]
slot = [ "dep:katana-slot-controller", "katana-primitives/slot" ]
starknet-messaging = [ "katana-node/starknet-messaging" ]
starknet-messaging = [ "katana-cli/starknet-messaging" ]
5 changes: 2 additions & 3 deletions bin/katana/src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
mod db;
mod node;
mod options;

use anyhow::Result;
use clap::{Args, CommandFactory, Parser, Subcommand};
use clap_complete::Shell;
use katana_cli::NodeArgs;
use katana_node::version::VERSION;

#[derive(Parser)]
Expand All @@ -14,7 +13,7 @@ pub struct Cli {
commands: Option<Commands>,

#[command(flatten)]
node: node::NodeArgs,
node: NodeArgs,
}

impl Cli {
Expand Down
1 change: 0 additions & 1 deletion bin/katana/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]

mod cli;
mod utils;

use anyhow::Result;
use clap::Parser;
Expand Down
79 changes: 0 additions & 79 deletions bin/katana/src/utils.rs

This file was deleted.

1 change: 1 addition & 0 deletions bin/torii/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ starknet.workspace = true
tokio-stream = "0.1.11"
tokio-util = "0.7.7"
tokio.workspace = true
torii-cli.workspace = true
torii-core.workspace = true
torii-graphql.workspace = true
torii-grpc = { workspace = true, features = [ "server" ] }
Expand Down
Loading

0 comments on commit cbdd2f0

Please sign in to comment.