Skip to content

Commit 1ff8ac9

Browse files
committed
Using Liquid to process templates
1 parent 09fdcde commit 1ff8ac9

File tree

4 files changed

+3
-9
lines changed

4 files changed

+3
-9
lines changed

native-simulator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
[dependencies]
8-
{{contract_name}} = { path = "../../contracts/{{contract_name}}", features = ["native-simulator"] }
8+
{{project-name | remove: "-sim"}} = { path = "../../contracts/{{project-name | remove: "-sim"}}", features = ["native-simulator"] }
99
ckb-std = { version = "0.15.3", features = ["native-simulator"] }
1010

1111
[lib]

native-simulator/cargo-generate.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
[template]
22
cargo_generate_version = ">=0.16.0"
3-
4-
[placeholders]
5-
contract_name = { prompt = "The name of the corresponding contract", type = "string" }
6-
contract_crate_name = { prompt = "The contract is used as the name of the module in the code. Generally, you need to replace - with _", type = "string" }

native-simulator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ckb_std::entry_simulator!({{contract_crate_name}}::program_entry);
1+
ckb_std::entry_simulator!({{project-name | remove: "-sim" | replace: "-", "_"}}::program_entry);

workspace/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ generate-native-simulator:
127127
@set -eu; \
128128
cargo generate $(TEMPLATE_TYPE) $(TEMPLATE_REPO) native-simulator \
129129
-n $(CRATE)-sim \
130-
--destination native-simulators \
131-
-d contract_name=$(CRATE) \
132-
-d contract_crate_name=`echo "$(CRATE)" | tr '-' '_'`; \
130+
--destination native-simulators; \
133131
sed '/@@INSERTION_POINT@@/s/$$/\n "native-simulators\/$(CRATE)-sim",/' Cargo.toml > Cargo.toml.new; \
134132
mv Cargo.toml.new Cargo.toml;
135133

0 commit comments

Comments
 (0)