Skip to content

Commit c2a9a9b

Browse files
committed
Update readme for standalone contract
1 parent fc1ec1a commit c2a9a9b

File tree

8 files changed

+31
-1
lines changed

8 files changed

+31
-1
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,33 @@ make test
176176
```
177177

178178
The templates provided here, use the same conventions as `ckb-native-build-sample` project, so feel free to refer to the more detailed [usage](https://github.com/xxuejie/ckb-native-build-sample?tab=readme-ov-file#usage) doc in the sample project.
179+
180+
### Standalone Contract Crate
181+
182+
In rare cases if you want to simply use a standalone contract crate without a workspace. The [standalone-contract](https://github.com/xxuejie/ckb-script-templates/tree/main/standalone-contract) template is prepared for you:
183+
184+
```
185+
$ cargo generate gh:xxuejie/ckb-script-templates contract-with-tests
186+
⚠️ Favorite `gh:xxuejie/ckb-script-templates` not found in config, using it as a git repository: https://github.com/xxuejie/ckb-script-templates.git
187+
🤷 Project Name: standalone-first-contract
188+
🔧 Destination: /tmp/standalone-first-contract ...
189+
🔧 project-name: standalone-first-contract ...
190+
🔧 Generating template ...
191+
🔧 Moving generated files into: `/tmp/standalone-first-contract`...
192+
🔧 Initializing a fresh Git repository
193+
✨ Done! New project created /tmp/standalone-first-contract
194+
```
195+
196+
You can then build and test the standalone crate as usual:
197+
198+
```
199+
$ cd standalone-first-contract
200+
$ make build
201+
$ make tests
202+
$ make check
203+
$ make clippy
204+
```
205+
206+
The template is tailored built for usage outside of workspace, typically, it is not expected to be used inside a workspace. Feel free to compare it with the default `contract` workspace for differences.
207+
208+
This standalone template also has its own test setup, where in a workspace, a dedicated `tests` crate will handle most of the testing work.

cargo-generate.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[template]
22
sub_templates = [
33
"contract",
4-
"contract-with-tests",
4+
"standalone-contract",
55
"workspace",
66
]
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)