Skip to content

Commit

Permalink
fix: rename templates crate (gorules#140)
Browse files Browse the repository at this point in the history
* fix: rename templates crate

* fix: update workflow
  • Loading branch information
stefan-gorules authored Apr 3, 2024
1 parent afbf48d commit ebba323
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions actions/cargo-version-action/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11270,12 +11270,12 @@ var toml = __nccwpck_require__(4920);

const versionRegex = /version = "[0-9]+\.[0-9]+\.[0-9]+"$/im;
const expressionDep = /zen-expression =.*$/im;
const templateDep = /zen-template =.*$/im;
const templateDep = /zen-tmpl =.*$/im;
const updateCargoContents = (contents, { version }) => {
return contents
.replace(versionRegex, `version = "${version}"`)
.replace(expressionDep, `zen-expression = { path = "../expression", version = "${version}" }`)
.replace(templateDep, `zen-template = { path = "../template", version = "${version}" }`);
.replace(templateDep, `zen-tmpl = { path = "../template", version = "${version}" }`);
};
const getCargoVersion = (contents) => {
var _a;
Expand Down
4 changes: 2 additions & 2 deletions actions/cargo-version-action/src/cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ type UpdateCargoOptions = {

const versionRegex = /version = "[0-9]+\.[0-9]+\.[0-9]+"$/im;
const expressionDep = /zen-expression =.*$/im;
const templateDep = /zen-template =.*$/im;
const templateDep = /zen-tmpl =.*$/im;

export const updateCargoContents = (contents: string, { version }: UpdateCargoOptions): string => {
return contents
.replace(versionRegex, `version = "${version}"`)
.replace(expressionDep, `zen-expression = { path = "../expression", version = "${version}" }`)
.replace(templateDep, `zen-template = { path = "../template", version = "${version}" }`);
.replace(templateDep, `zen-tmpl = { path = "../template", version = "${version}" }`);
};

export const getCargoVersion = (contents: string): string => {
Expand Down
2 changes: 1 addition & 1 deletion actions/cargo-version-action/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const makeToml = ({ version }): string => `
futures = "0.3.27"
v8 = { version = "0.66.0" }
zen-expression = { path = "../expression", version = "${version}" }
zen-template = { path = "../template", version = "${version}" }
zen-tmpl = { path = "../template", version = "${version}" }
`;

describe('GitHub Action', () => {
Expand Down
2 changes: 1 addition & 1 deletion bindings/c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ strum = { version = "0.26.1", features = ["derive"] }
futures = "0.3.28"
zen-engine = { path = "../../core/engine" }
zen-expression = { path = "../../core/expression" }
zen-template = { path = "../../core/template" }
zen-tmpl = { path = "../../core/template" }

[lib]
crate-type = ["staticlib"]
Expand Down
2 changes: 1 addition & 1 deletion bindings/c/src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub extern "C" fn zen_evaluate_template(
return ZenResult::error(ZenError::JsonDeserializationFailed);
};

let result = match zen_template::render(template_str, &context_val) {
let result = match zen_tmpl::render(template_str, &context_val) {
Ok(r) => r,
Err(err) => {
return ZenResult::error(ZenError::TemplateEngineError {
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ serde_json = { workspace = true }
futures = { workspace = true }
zen-engine = { path = "../../core/engine" }
zen-expression = { path = "../../core/expression" }
zen-template = { path = "../../core/template" }
zen-tmpl = { path = "../../core/template" }
serde = { workspace = true, features = ["derive"] }
json_dotpath = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn evaluate_unary_expression_sync(expression: String, context: Value) -> nap
#[allow(dead_code)]
#[napi]
pub fn render_template_sync(template: String, context: Value) -> napi::Result<Value> {
Ok(zen_template::render(template.as_str(), &context)
Ok(zen_tmpl::render(template.as_str(), &context)
.map_err(|e| anyhow!(serde_json::to_string(&e).unwrap_or_else(|_| e.to_string())))?)
}

Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl ZenEngineHandlerRequest {
return Ok(selected_value);
};

let template_value = zen_template::render(template.as_str(), &self.input)
let template_value = zen_tmpl::render(template.as_str(), &self.input)
.map_err(|e| anyhow!(serde_json::to_string(&e).unwrap_or_else(|_| e.to_string())))?;

Ok(template_value)
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ serde_json = { workspace = true }
futures = { workspace = true }
zen-engine = { path = "../../core/engine" }
zen-expression = { path = "../../core/expression" }
zen-template = { path = "../../core/template" }
zen-tmpl = { path = "../../core/template" }
2 changes: 1 addition & 1 deletion bindings/python/src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn evaluate_unary_expression(expression: String, ctx: &PyDict) -> PyResult<b
pub fn render_template(py: Python, template: String, ctx: &PyDict) -> PyResult<PyObject> {
let context: Value = depythonize(ctx).context("Failed to convert context")?;

let result = zen_template::render(template.as_str(), &context)
let result = zen_tmpl::render(template.as_str(), &context)
.map_err(|e| anyhow!(serde_json::to_string(&e).unwrap_or_else(|_| e.to_string())))?;

Ok(PyValue(result).to_object(py))
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl PyNodeRequest {
return Ok(PyValue(selected_value).to_object(py));
};

let template_value = zen_template::render(template.as_str(), &self.inner_input)
let template_value = zen_tmpl::render(template.as_str(), &self.inner_input)
.map_err(|e| anyhow!(serde_json::to_string(&e).unwrap_or_else(|_| e.to_string())))?;

Ok(PyValue(template_value).to_object(py))
Expand Down
2 changes: 1 addition & 1 deletion core/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ futures = { workspace = true }
rquickjs = { version = "0.4.3", features = ["macro", "loader", "rust-alloc"] }
itertools = "0.12.1"
zen-expression = { path = "../expression", version = "0.20.0" }
zen-template = { path = "../template", version = "0.20.0" }
zen-tmpl = { path = "../template", version = "0.20.0" }

[dev-dependencies]
tokio = { version = "1.35.1", features = ["rt", "macros"] }
Expand Down
4 changes: 2 additions & 2 deletions core/engine/src/handler/custom_node_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anyhow::anyhow;
use json_dotpath::DotPaths;
use serde::Serialize;
use serde_json::Value;
use zen_template::TemplateRenderError;
use zen_tmpl::TemplateRenderError;

pub trait CustomNodeAdapter {
fn handle(
Expand Down Expand Up @@ -50,7 +50,7 @@ impl<'a> CustomNodeRequest<'a> {
return Ok(Some(selected_value));
};

let template_value = zen_template::render(template.as_str(), &self.input)?;
let template_value = zen_tmpl::render(template.as_str(), &self.input)?;
Ok(Some(template_value))
}

Expand Down
2 changes: 1 addition & 1 deletion core/template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["GoRules Team <[email protected]>"]
description = "Zen Template Language"
name = "zen-template"
name = "zen-tmpl"
license = "MIT"
version = "0.20.0"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion core/template/tests/template.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde_json::{json, Value};
use zen_template::render;
use zen_tmpl::render;

#[test]
fn test_values_types() {
Expand Down

0 comments on commit ebba323

Please sign in to comment.