Skip to content

Commit 004dbc7

Browse files
committed
feat: add rust template for discounts allocator
1 parent 97eab5a commit 004dbc7

File tree

10 files changed

+4584
-657
lines changed

10 files changed

+4584
-657
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
Cargo.lock
3+
*.output.graphql
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "{{handle | replace: " ", "-" | downcase}}"
3+
version = "1.0.0"
4+
edition = "2021"
5+
rust-version = "1.62"
6+
7+
[dependencies]
8+
serde = { version = "1.0.13", features = ["derive"] }
9+
serde_json = "1.0"
10+
shopify_function = "0.4.0"
11+
graphql_client = "0.13.0"
12+
13+
[profile.release]
14+
lto = true
15+
opt-level = 'z'
16+
strip = true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Shopify Function development with Rust
2+
3+
## Dependencies
4+
5+
- [Install Rust](https://www.rust-lang.org/tools/install)
6+
- 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.
7+
- Install [`cargo-wasi`](https://bytecodealliance.github.io/cargo-wasi/)
8+
- `cargo install cargo-wasi`
9+
10+
## Building the function
11+
12+
You can build this individual function using `cargo wasi`.
13+
14+
```shell
15+
cargo wasi build --release
16+
```
17+
18+
The Shopify CLI `build` command will also execute this, based on the configuration in `shopify.extension.toml`.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "{{name}}",
3+
"description": "{{name}}"
4+
}

0 commit comments

Comments
 (0)