Skip to content
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
2 changes: 2 additions & 0 deletions discounts/rust/discounts/default/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
Cargo.lock
16 changes: 16 additions & 0 deletions discounts/rust/discounts/default/Cargo.toml.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "{{handle | replace: " ", "-" | downcase}}"
version = "1.0.0"
edition = "2021"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "2025"?

rust-version = "1.84"

[dependencies]
serde = { version = "1.0.13", features = ["derive"] }
serde_json = "1.0"
shopify_function = "0.8.1"
graphql_client = "0.14.0"

[profile.release]
lto = true
opt-level = 'z'
strip = true
16 changes: 16 additions & 0 deletions discounts/rust/discounts/default/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Shopify Function development with Rust

## Dependencies

- [Install Rust](https://www.rust-lang.org/tools/install)
- On Windows, Rust requires the [Microsoft C++ Build Tools](https://docs.microsoft.com/en-us/windows/dev-environment/rust/setup). Be sure to select the _Desktop development with C++_ workload when installing them.

## Building the function

You can build this individual function using `cargo build`.

```shell
cargo build --target=wasm32-wasip1 --release
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't this target added with the newer Rust version? Seems this could also be a reason to bump the Rust version.

Copy link
Contributor

@jonathanhamel4 jonathanhamel4 Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true, however this target has been available before this release, it just became the new default with 1.84

```

The Shopify CLI `build` command will also execute this, based on the configuration in `shopify.extension.toml`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "{{name}}",
"description": "{{name}}"
}
Loading
Loading