chore: Cleanup code before release and update deps

This commit is contained in:
Gerald Pinder 2025-01-31 23:20:51 -05:00
parent 3d0ae32734
commit f829580087
6 changed files with 264 additions and 220 deletions

453
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -79,6 +79,7 @@ rayon = { version = "1", optional = true }
regex = { version = "1", optional = true }
requestty = { version = "0.5", features = ["macros", "termion"] }
shadow-rs = { version = "0.38", default-features = false }
thiserror = "2"
urlencoding = "2"
yaml-rust2 = { version = "0.9", optional = true }
@ -102,7 +103,6 @@ tempfile.workspace = true
tokio = { workspace = true, optional = true }
bon.workspace = true
users.workspace = true
thiserror = "2.0.7"
[features]
# Top level features

View file

@ -14,7 +14,7 @@ use cached::proc_macro::cached;
use colored::Colorize;
use comlexr::{cmd, pipe};
use log::{debug, info, trace, warn};
use miette::{bail, miette, IntoDiagnostic, Result};
use miette::{bail, IntoDiagnostic, Result};
use oci_distribution::Reference;
use once_cell::sync::Lazy;
use semver::Version;
@ -292,7 +292,7 @@ impl BuildDriver for DockerDriver {
Ok((system.join()?, buildx.join()?))
},
)
.map_err(|e| miette!("{e:?}"))?;
.map_err(|e| miette::miette!("{e:?}"))?;
if !system?.success() {
bail!("Failed to prune docker system");

View file

@ -6,6 +6,9 @@ use std::{
use blue_build_process_management::ASYNC_RUNTIME;
use blue_build_recipe::ModuleTypeVersion;
use blue_build_utils::constants::{
CUSTOM_MODULE_SCHEMA, IMPORT_MODULE_SCHEMA, JSON_SCHEMA, STAGE_SCHEMA,
};
use bon::bon;
use cached::proc_macro::cached;
use colored::Colorize;
@ -222,15 +225,15 @@ fn process_anyof_error(err: &ValidationError<'_>) -> Option<Vec<ValidationError<
) => {
trace!("FOUND MODULE ANYOF ERROR at {instance_path}");
if instance.get("source").is_some() {
Uri::parse("json-schema:///module-custom-v1.json".to_string()).ok()?
Uri::parse(CUSTOM_MODULE_SCHEMA.to_string()).ok()?
} else if instance.get("from-file").is_some() {
Uri::parse("json-schema:///import-v1.json".to_string()).ok()?
Uri::parse(IMPORT_MODULE_SCHEMA.to_string()).ok()?
} else {
let typ = instance.get("type").and_then(Value::as_str)?;
let typ = ModuleTypeVersion::from(typ);
trace!("Module type: {typ}");
Uri::parse(format!(
"json-schema:///modules/{}-{}.json",
"{JSON_SCHEMA}/modules/{}-{}.json",
typ.typ(),
typ.version().unwrap_or("latest")
))
@ -245,9 +248,9 @@ fn process_anyof_error(err: &ValidationError<'_>) -> Option<Vec<ValidationError<
trace!("FOUND STAGE ANYOF ERROR at {instance_path}");
if instance.get("from-file").is_some() {
Uri::parse("json-schema:///import-v1.json".to_string()).ok()?
Uri::parse(IMPORT_MODULE_SCHEMA.to_string()).ok()?
} else {
Uri::parse("json-schema:///stage-v1.json".to_string()).ok()?
Uri::parse(STAGE_SCHEMA.to_string()).ok()?
}
}
_ => return None,
@ -317,11 +320,11 @@ async fn cache_retrieve(uri: &Uri<&str>) -> miette::Result<Value> {
#[cfg(not(test))]
{
const BASE_SCHEMA_URL: &str = "https://schema.blue-build.org";
use blue_build_utils::constants::SCHEMA_BASE_URL;
let uri = match scheme.as_str() {
"json-schema" => {
format!("{BASE_SCHEMA_URL}{path}")
format!("{SCHEMA_BASE_URL}{path}")
}
"https" => uri.to_string(),
scheme => miette::bail!("Unknown scheme {scheme}"),

View file

@ -12,6 +12,7 @@ license.workspace = true
atty = "0.2"
base64 = "0.22"
blake2 = "0.10"
constcat = "0.5"
directories = "6"
docker_credential = "1"
format_serde_error = "0.3"
@ -28,7 +29,6 @@ serde_json.workspace = true
serde_yaml.workspace = true
syntect.workspace = true
bon.workspace = true
constcat = "0.5.1"
[build-dependencies]
syntect = "5"

View file

@ -98,6 +98,12 @@ pub const MODULE_V1_SCHEMA_URL: &str = concat!(SCHEMA_BASE_URL, "/module-v1.json
pub const MODULE_STAGE_LIST_V1_SCHEMA_URL: &str =
concat!(SCHEMA_BASE_URL, "/module-stage-list-v1.json");
// JSON Schema
pub const JSON_SCHEMA: &str = "json-schema://";
pub const CUSTOM_MODULE_SCHEMA: &str = concat!(JSON_SCHEMA, "/module-custom-v1.json");
pub const IMPORT_MODULE_SCHEMA: &str = concat!(JSON_SCHEMA, "/import-v1.json");
pub const STAGE_SCHEMA: &str = concat!(JSON_SCHEMA, "/stage-v1.json");
// Messages
pub const BUG_REPORT_WARNING_MESSAGE: &str =
"Please copy the above report and open an issue manually.";