Skip to content

Commit 90950db

Browse files
committed
Merge branch 'feature/smbcloud-cli-on-smbcloud' into development
2 parents 108528a + 694f564 commit 90950db

File tree

6 files changed

+25
-12
lines changed

6 files changed

+25
-12
lines changed

.smb/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ description = 'smbCloud CLI monorepo'
55
id = 28
66
name = "smbcloud-cli"
77
repository = "smbcloud-cli"
8+
runner = 255
89
description = "smbcloud cli monorepo"
910
created_at = "2025-05-29T16:41:20.350Z"
1011
updated_at = "2025-05-29T16:41:20.350Z"

crates/cli/src/deploy/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use {
1616
std::{fs, path::Path},
1717
};
1818

19-
pub(crate) async fn check_config(
19+
pub(crate) async fn get_config(
2020
env: Environment,
2121
access_token: Option<&str>,
2222
) -> Result<Config, ErrorResponse> {

crates/cli/src/deploy/detect_runner.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ pub(crate) async fn detect_runner() -> Result<Runner> {
1717
Err(_) => {
1818
spinner.stop_and_persist(
1919
&fail_symbol(),
20-
fail_message(
21-
"Could not detect project runner: no package.json, Gemfile, or Package.swift found",
22-
),
20+
fail_message("Could not get the current path."),
2321
);
2422
anyhow::bail!(
2523
"Could not detect project runner: no package.json, Gemfile, or Package.swift found"
@@ -42,6 +40,12 @@ pub(crate) async fn detect_runner() -> Result<Runner> {
4240
};
4341

4442
match runner {
43+
Runner::Monorepo => {
44+
spinner.stop_and_persist(
45+
&succeed_symbol(),
46+
succeed_message("Monorepo universal runner"),
47+
);
48+
}
4549
Runner::NodeJs => {
4650
spinner.stop_and_persist(
4751
&succeed_symbol(),

crates/cli/src/deploy/process_deploy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use {
44
cli::CommandResult,
55
client,
66
deploy::{
7-
config::{check_config, check_project, credentials},
7+
config::{check_project, credentials, get_config},
88
detect_runner::detect_runner,
99
git::remote_deployment_setup,
1010
remote_messages::{build_next_app, start_server},
@@ -39,7 +39,7 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
3939
let access_token = get_smb_token(env)?;
4040

4141
// Check config.
42-
let config = check_config(env, Some(&access_token)).await?;
42+
let config = get_config(env, Some(&access_token)).await?;
4343

4444
// Check runner.
4545
let runner = detect_runner().await?;

crates/cli/src/project/deployment.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::client;
22
use crate::token::get_smb_token::get_smb_token;
33
use crate::{
44
cli::CommandResult,
5-
deploy::config::{check_config, check_project},
5+
deploy::config::{check_project, get_config},
66
ui::{succeed_message, succeed_symbol},
77
};
88
use anyhow::Result;
@@ -19,7 +19,7 @@ pub(crate) async fn process_deployment(
1919
let mut spinner: Spinner =
2020
Spinner::new(spinners::Spinners::Hamburger, succeed_message("Loading"));
2121
// Load project id from .smb/config.toml
22-
let config = check_config(env, None).await?;
22+
let config = get_config(env, None).await?;
2323

2424
let access_token = get_smb_token(env)?;
2525

crates/smbcloud-model/src/runner.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub enum Runner {
1616
NodeJs,
1717
Ruby,
1818
Swift,
19+
Monorepo = 255,
1920
}
2021

2122
impl Display for Runner {
@@ -45,6 +46,7 @@ pub enum SwiftFramework {
4546

4647
impl Runner {
4748
pub fn from(repo_path: &PathBuf) -> Result<Runner, ErrorResponse> {
49+
// See if we have a framework-based config.
4850
if repo_path.join("package.json").exists()
4951
&& (next_config_exists(repo_path) || astro_config_exists(repo_path))
5052
{
@@ -57,10 +59,8 @@ impl Runner {
5759
if repo_path.join("Package.swift").exists() {
5860
return Ok(Runner::Swift);
5961
}
60-
Err(ErrorResponse::Error {
61-
error_code: UnsupportedRunner,
62-
message: UnsupportedRunner.message(None).to_string(),
63-
})
62+
// See if we have a monorepo setup.
63+
non_framework_runner()
6464
}
6565

6666
pub fn git_host(&self) -> String {
@@ -69,12 +69,20 @@ impl Runner {
6969

7070
fn api(&self) -> &str {
7171
match self {
72+
Runner::Monorepo => "monorepo",
7273
Runner::NodeJs => "api",
7374
Runner::Ruby | Runner::Swift => "api-1",
7475
}
7576
}
7677
}
7778

79+
fn non_framework_runner() -> Result<Runner, ErrorResponse> {
80+
Err(ErrorResponse::Error {
81+
error_code: UnsupportedRunner,
82+
message: UnsupportedRunner.message(None).to_string(),
83+
})
84+
}
85+
7886
// Helper function to detect any next.config.* file
7987
fn next_config_exists(repo_path: &PathBuf) -> bool {
8088
if let Ok(entries) = fs::read_dir(repo_path) {

0 commit comments

Comments
 (0)