Skip to content

Commit

Permalink
deps(schematic): Upgrade to v0.17. (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj authored Aug 12, 2024
1 parent 8d13114 commit f216a69
Show file tree
Hide file tree
Showing 28 changed files with 355 additions and 278 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
- [Rust](https://github.com/moonrepo/tools/blob/master/tools/rust/CHANGELOG.md)
- [TOML schema](https://github.com/moonrepo/tools/blob/master/tools/internal-schema/CHANGELOG.md)

## Unreleased

#### 🚀 Updates

- WASM API
- Added `ToolMetadataOutput.config_schema`, which can be used to define a JSON schema for the plugins configuration.

## 0.39.5

#### 💥 Breaking
Expand Down
26 changes: 14 additions & 12 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ reqwest = { version = "0.12.5", default-features = false, features = [
"macos-system-configuration",
] }
rustc-hash = "2.0.0"
schematic = { version = "0.16.6", default-features = false }
schematic = { version = "0.17.1", default-features = false }
semver = { version = "1.0.23", features = ["serde"] }
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.120"
Expand Down
16 changes: 9 additions & 7 deletions crates/cli/src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,23 @@ impl<'std> Printer<'std> {

pub fn locator<L: AsRef<PluginLocator>>(&mut self, locator: L) {
match locator.as_ref() {
PluginLocator::File { path, .. } => {
self.entry(
"File",
color::path(path.as_ref().unwrap().canonicalize().unwrap()),
);
PluginLocator::File(file) => {
self.entry("File", color::path(file.get_resolved_path()));
}
PluginLocator::GitHub(github) => {
self.entry("GitHub", color::label(&github.repo_slug));

if let Some(name) = &github.project_name {
self.entry("Project", color::label(name));
}

self.entry(
"Tag",
color::hash(github.tag.as_deref().unwrap_or("latest")),
);
}
PluginLocator::Url { url } => {
self.entry("URL", color::url(url));
PluginLocator::Url(url) => {
self.entry("URL", color::url(&url.url));
}
};
}
Expand Down
10 changes: 5 additions & 5 deletions crates/cli/tests/plugin_add_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod utils;

use proto_core::PluginLocator;
use proto_core::{warpgate::UrlLocator, PluginLocator};
use starbase_sandbox::predicates::prelude::*;
use utils::*;

Expand Down Expand Up @@ -45,11 +45,11 @@ mod plugin_add {

assert_eq!(
config.plugins.get("id").unwrap(),
&PluginLocator::Url {
&PluginLocator::Url(Box::new(UrlLocator {
url:
"https://github.com/moonrepo/tools/releases/latest/download/example_plugin.wasm"
.into()
}
}))
);
}

Expand All @@ -76,11 +76,11 @@ mod plugin_add {

assert_eq!(
config.plugins.get("id").unwrap(),
&PluginLocator::Url {
&PluginLocator::Url(Box::new(UrlLocator {
url:
"https://github.com/moonrepo/tools/releases/latest/download/example_plugin.wasm"
.into()
}
}))
);
}
}
10 changes: 5 additions & 5 deletions crates/cli/tests/plugin_remove_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod utils;

use proto_core::{Id, PluginLocator, ProtoConfig};
use proto_core::{warpgate::UrlLocator, Id, PluginLocator, ProtoConfig};
use starbase_sandbox::predicates::prelude::*;
use utils::*;

Expand Down Expand Up @@ -30,9 +30,9 @@ mod plugin_remove {
.get_or_insert(Default::default())
.insert(
Id::raw("id"),
PluginLocator::Url {
PluginLocator::Url(Box::new(UrlLocator {
url: "https://github.com/moonrepo/tools/releases/latest/download/example_plugin.wasm".into()
},
})),
);
})
.unwrap();
Expand All @@ -58,9 +58,9 @@ mod plugin_remove {
.get_or_insert(Default::default())
.insert(
Id::raw("id"),
PluginLocator::Url {
PluginLocator::Url(Box::new(UrlLocator {
url: "https://github.com/moonrepo/tools/releases/latest/download/example_plugin.wasm".into()
},
})),
);
})
.unwrap();
Expand Down
19 changes: 10 additions & 9 deletions crates/cli/tests/plugins_test.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod utils;

use proto_core::{
load_tool_from_locator, Id, PluginLocator, ProtoEnvironment, Tool, UnresolvedVersionSpec,
load_tool_from_locator, warpgate::FileLocator, warpgate::UrlLocator, Id, PluginLocator,
ProtoEnvironment, Tool, UnresolvedVersionSpec,
};
use starbase_sandbox::assert_snapshot;
use starbase_sandbox::predicates::prelude::*;
Expand Down Expand Up @@ -53,10 +54,10 @@ mod plugins {
load_tool_from_locator(
Id::raw("moon"),
env.to_owned(),
PluginLocator::File {
PluginLocator::File(Box::new(FileLocator {
file: "./tests/fixtures/moon-schema.toml".into(),
path: Some(root_dir.join("./tests/fixtures/moon-schema.toml")),
},
})),
)
})
.await;
Expand All @@ -71,10 +72,10 @@ mod plugins {
load_tool_from_locator(
Id::raw("moon"),
env.to_owned(),
PluginLocator::File {
PluginLocator::File(Box::new(FileLocator {
file: "./some/fake/path.toml".into(),
path: Some(root_dir.join("./some/fake/path.toml")),
},
})),
)
})
.await;
Expand All @@ -86,10 +87,10 @@ mod plugins {
load_tool_from_locator(
Id::raw("moon"),
env.to_owned(),
PluginLocator::Url {
PluginLocator::Url(Box::new(UrlLocator {
url: "https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml"
.into(),
},
})),
)
})
.await;
Expand All @@ -102,10 +103,10 @@ mod plugins {
load_tool_from_locator(
Id::raw("moon"),
env.to_owned(),
PluginLocator::Url {
PluginLocator::Url(Box::new(UrlLocator {
url: "https://raw.githubusercontent.com/moonrepo/moon/some/fake/path.toml"
.into(),
},
})),
)
})
.await;
Expand Down
1 change: 1 addition & 0 deletions crates/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ proto_pdk_api = { version = "0.22.0", path = "../pdk-api", features = [
"schematic",
] }
schematic = { workspace = true, features = [
"schema",
"renderer_json_schema",
"renderer_typescript",
] }
Expand Down
8 changes: 5 additions & 3 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ homepage = "https://moonrepo.dev/proto"
repository = "https://github.com/moonrepo/proto"

[dependencies]
proto_pdk_api = { version = "0.22.0", path = "../pdk-api" }
proto_pdk_api = { version = "0.22.0", path = "../pdk-api", features = [
"schematic",
] }
proto_shim = { version = "0.4.3", path = "../shim" }
version_spec = { version = "0.6.1", path = "../version-spec", features = [
"schematic",
Expand All @@ -25,11 +27,11 @@ reqwest = { workspace = true }
rustc-hash = { workspace = true }
schematic = { workspace = true, features = [
"config",
"env",
"toml",
"type_indexmap",
"type_serde_json",
"type_serde_toml",
"type_url",
"validate",
] }
semver = { workspace = true }
serde = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ pub use version_spec::*;

// Only export things consumers will actually need!
pub use semver::{Version, VersionReq};
pub use warpgate;
pub use warpgate::{Id, PluginLocator};
Loading

0 comments on commit f216a69

Please sign in to comment.