-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #1584 --------- Co-authored-by: Piotr Magiera <56825108+piotmag769@users.noreply.github.com>
- Loading branch information
1 parent
306ec59
commit eef9da0
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
website/docs/tutorials/08-cairo-1-support/01-project-initialization.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
sidebar_label: Project initialization | ||
--- | ||
|
||
# Project initialization | ||
|
||
## Creating a project | ||
To create a new Protostar project with cairo1 support, you will need to run the `protostar init-cairo1` command followed by the name of your project. For example: | ||
|
||
```shell | ||
protostar init-cairo1 my-project | ||
``` | ||
|
||
After running the command, the following structure will be generated: | ||
|
||
``` | ||
my-project/ | ||
├── src/ | ||
│ └── main.cairo | ||
│ └── lib.cairo | ||
│ └── cairo_project.toml | ||
├── tests/ | ||
│ └── test_main.cairo | ||
└── protostar.toml | ||
``` | ||
|
||
This template contains: | ||
|
||
- `src` directory | ||
- `cairo_project.toml` which is needed for compilation | ||
- `main.cairo` file with one function definition | ||
- `lib.cairo` file which defines the module | ||
- `test` directory | ||
- Single test file with one test for function defined in `main.cairo` | ||
- `protostar.toml` containing information about the project | ||
|
||
## The protostar.toml | ||
Apart from the usual things you can find in `protostar.toml`, there is a `linked-libarires` entry which is used to find cairo 1 modules in tests and building. | ||
This makes it possible for you to include other modules from your dependencies if they are correct cairo 1 modules (with their own module definition and `cairo_project.toml`). | ||
|
||
``` | ||
[project] | ||
protostar-version = "0.9.2" | ||
lib-path = "lib" | ||
linked-libraries = ["src"] | ||
[contracts] | ||
``` | ||
|
||
:::warning | ||
`[contracts]` section is not usable right now, since protostar can't build cairo 1 contracts yet | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters