Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Bring back bin-path and add deprecation notices. #656

Merged
merged 6 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
- [Rust](https://github.com/moonrepo/tools/blob/master/tools/rust/CHANGELOG.md)
- [Schema (TOML, JSON, YAML)](https://github.com/moonrepo/tools/blob/master/tools/internal-schema/CHANGELOG.md)

## Unreleased

#### 🚀 Updates

- When adding or viewing a plugin, we now display any deprecation messages from the plugin to the user.
- WASM API
- Added `ToolMetadataOutput.deprecations`.

#### 🧩 Plugins

- Updated `schema_tool` to v0.16.1.
- Brought back `platform.*.bin-path` to support legacy plugin configs.

## 0.42.1

#### 🚀 Updates
Expand Down
4 changes: 2 additions & 2 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 crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ path = "src/main_shim.rs"
[dependencies]
proto_core = { version = "0.43.5", path = "../core", features = ["clap"] }
proto_installer = { version = "0.7.1", path = "../installer" }
proto_pdk_api = { version = "0.24.2", path = "../pdk-api" }
proto_pdk_api = { version = "0.24.3", path = "../pdk-api" }
proto_shim = { version = "0.5.0", path = "../shim" }
system_env = { version = "0.6.1", path = "../system-env" }
anyhow = { workspace = true }
Expand Down
25 changes: 25 additions & 0 deletions crates/cli/src/commands/plugin/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,31 @@ pub async fn add(session: ProtoSession, args: AddPluginArgs) -> AppResult {
},
)?;

// Load the tool and verify it works. We can't load the tool with the
// session as the config has already been cached, and doesn't reflect
// the recent addition!
#[cfg(not(debug_assertions))]
{
use proto_core::load_tool_from_locator;
use starbase_styles::color::apply_style_tags;

let tool = load_tool_from_locator(&args.id, &session.env, &args.plugin).await?;

if !tool.metadata.deprecations.is_empty() {
let mut output = color::caution("Deprecation notices from the plugin:\n");

for msg in &tool.metadata.deprecations {
output.push_str(" ");
output.push_str(&color::muted("-"));
output.push(' ');
output.push_str(&apply_style_tags(msg));
output.push('\n');
}

println!("{output}");
}
}

println!(
"Added plugin {} to config {}",
color::id(&args.id),
Expand Down
10 changes: 9 additions & 1 deletion crates/cli/src/commands/plugin/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use proto_core::{
use proto_pdk_api::ToolMetadataOutput;
use serde::Serialize;
use starbase::AppResult;
use starbase_styles::color;
use starbase_styles::color::{self, apply_style_tags};
use starbase_utils::json;
use std::path::PathBuf;

Expand Down Expand Up @@ -88,6 +88,14 @@ pub async fn info(session: ProtoSession, args: InfoPluginArgs) -> AppResult {
p.locator(locator);
}

if !tool.metadata.deprecations.is_empty() {
p.entry_list(
"Deprecations",
tool.metadata.deprecations.iter().map(apply_style_tags),
None,
);
}

Ok(())
})?;

Expand Down
2 changes: 1 addition & 1 deletion crates/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dist = false

[dependencies]
proto_core = { version = "0.43.5", path = "../core" }
proto_pdk_api = { version = "0.24.2", path = "../pdk-api", features = [
proto_pdk_api = { version = "0.24.3", path = "../pdk-api", features = [
"schematic",
] }
schematic = { workspace = true, features = [
Expand Down
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ homepage = "https://moonrepo.dev/proto"
repository = "https://github.com/moonrepo/proto"

[dependencies]
proto_pdk_api = { version = "0.24.2", path = "../pdk-api", features = [
proto_pdk_api = { version = "0.24.3", path = "../pdk-api", features = [
"schematic",
] }
proto_shim = { version = "0.5.0", path = "../shim" }
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/proto_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl ProtoConfig {
self.plugins.insert(
Id::raw(SCHEMA_PLUGIN_KEY),
PluginLocator::Url(Box::new(UrlLocator {
url: "https://github.com/moonrepo/tools/releases/download/schema_tool-v0.16.0/schema_tool.wasm".into()
url: "https://github.com/moonrepo/tools/releases/download/schema_tool-v0.16.1/schema_tool.wasm".into()
}))
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/pdk-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "proto_pdk_api"
version = "0.24.2"
version = "0.24.3"
edition = "2021"
license = "MIT"
description = "Core APIs for creating proto WASM plugins."
Expand Down
5 changes: 5 additions & 0 deletions crates/pdk-api/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ api_struct!(
#[serde(default, skip_serializing_if = "Option::is_none")]
pub default_version: Option<UnresolvedVersionSpec>,

/// List of deprecation messages that will be displayed to users
/// of this plugin.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub deprecations: Vec<String>,

/// Controls aspects of the tool inventory.
#[serde(default)]
pub inventory: ToolInventoryMetadata,
Expand Down
2 changes: 1 addition & 1 deletion crates/pdk-test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repository = "https://github.com/moonrepo/proto"

[dependencies]
proto_core = { version = "0.43.5", path = "../core" }
proto_pdk_api = { version = "0.24.2", path = "../pdk-api" }
proto_pdk_api = { version = "0.24.3", path = "../pdk-api" }
warpgate = { version = "0.19.0", path = "../warpgate" }
# extism = { workspace = true }
serde = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/pdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "proto_pdk"
version = "0.25.2"
version = "0.25.3"
edition = "2021"
license = "MIT"
description = "A plugin development kit for creating proto WASM plugins."
homepage = "https://moonrepo.dev/proto"
repository = "https://github.com/moonrepo/proto"

[dependencies]
proto_pdk_api = { version = "0.24.2", path = "../pdk-api" }
proto_pdk_api = { version = "0.24.3", path = "../pdk-api" }
warpgate_pdk = { version = "0.8.1", path = "../warpgate-pdk" }
extism-pdk = { workspace = true }
rustc-hash = { workspace = true }
Expand Down