mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
feat: create cargo workspace
This commit is contained in:
+16
@@ -8,3 +8,19 @@ pnpm-lock.yaml
|
||||
|
||||
examples/playground/
|
||||
|
||||
## Rust related ignores
|
||||
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
**/debug/
|
||||
**/target/
|
||||
|
||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||
**/Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/cli"
|
||||
]
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "tuono"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
authors = ["V. Ageno <valerioageno@yahoo.it>"]
|
||||
|
||||
[lib]
|
||||
name = "tuono"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.4", features = ["derive"] }
|
||||
cargo-watch = "8.5.2"
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
# Tuono
|
||||
@@ -0,0 +1,12 @@
|
||||
fn is_valid_project_folder(_directory: &String) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub fn run(directory: String) {
|
||||
if !is_valid_project_folder(&directory) {
|
||||
println!("It does not seem to be a valid project folder");
|
||||
return;
|
||||
}
|
||||
|
||||
todo!()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
pub fn run() {
|
||||
println!("Running dev environment");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
pub mod build;
|
||||
pub mod dev;
|
||||
pub mod new;
|
||||
@@ -0,0 +1,3 @@
|
||||
pub fn run() {
|
||||
println!("Scaffold new project");
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
use clap::{Parser, Subcommand};
|
||||
pub mod actions;
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
enum Actions {
|
||||
/// Start the development environment
|
||||
Dev,
|
||||
/// Build the production assets
|
||||
Build {
|
||||
#[arg(short, long, default_value_t = String::from("."))]
|
||||
directory: String,
|
||||
},
|
||||
/// Create a new project folder
|
||||
New {
|
||||
#[arg(short, long, default_value_t = String::from("."))]
|
||||
_directory: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about = "The react/rust fullstack framework")]
|
||||
struct Args {
|
||||
#[command(subcommand)]
|
||||
action: Option<Actions>,
|
||||
}
|
||||
|
||||
pub fn cli() {
|
||||
let args = Args::parse();
|
||||
|
||||
match args.action.unwrap() {
|
||||
Actions::Dev => actions::dev::run(),
|
||||
Actions::Build { directory } => actions::build::run(directory),
|
||||
Actions::New { _directory } => actions::new::run(),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
use tuono::cli;
|
||||
|
||||
fn main() {
|
||||
cli();
|
||||
}
|
||||
Reference in New Issue
Block a user