Skip to content

Commit

Permalink
[plugin] add setup function
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Apr 15, 2024
1 parent 4e9399d commit c7c38f9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dagger.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bun",
"sdk": "github.com/fluentci-io/daggerverse/deno-sdk@main",
"version": "v0.7.0",
"version": "v0.7.1",
"description": "",
"author": "Tsiry Sandratraina",
"license": "MIT"
Expand Down
2 changes: 1 addition & 1 deletion plugin/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 plugin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "bun"
version = "0.7.0"
version = "0.7.1"

[lib]
crate-type = ["cdylib"]
Expand Down
16 changes: 16 additions & 0 deletions plugin/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
use extism_pdk::*;
use fluentci_pdk::dag;

#[plugin_fn]
pub fn setup(version: String) -> FnResult<String> {
let version = if version.is_empty() {
"latest".to_string()
} else {
version
};

let stdout = dag()
.pkgx()?
.with_exec(vec!["type node > /dev/null || pkgx install node"])?
.with_exec(vec!["pkgx", "install", &format!("bun@{}", version)])?
.stdout()?;
Ok(stdout)
}

#[plugin_fn]
pub fn test(args: String) -> FnResult<String> {
let stdout = dag()
Expand Down

0 comments on commit c7c38f9

Please sign in to comment.