You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/getting_started/03_hello.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,9 +45,7 @@ hello/
45
45
```
46
46
47
47
The program ID in `program` is the official name that other developers will be able to look up after the program has been deployed to a network. This must be the same as the name of your program in `main.leo`, or compilation will fail.
48
-
```json
49
-
"program": "hello.aleo",
50
-
```
48
+
51
49
52
50
Dependencies will be added to the field of the same name, as they are imported. Dependencies that are only used during development and not in production will be added to the `dev_dependencies` field.
53
51
@@ -111,11 +109,11 @@ All programs must have an explicitly declared constructor function.
111
109
For now, we'll leave it as is, which will prevent upgrades from occurring. For more details on how program upgradability works, and different patterns for upgrading your programs, check out [Upgrading Programs](./../guides/10_program_upgradability.md).
112
110
113
111
114
-
Now let's compile the program and run the program.
**program.json** is the Leo manifest file that configures our package.
11
11
```json title="program.json"
@@ -14,7 +14,8 @@ sidebar_label: Project Layout
14
14
"version": "0.1.0",
15
15
"description": "",
16
16
"license": "MIT",
17
-
"dependencies": null
17
+
"dependencies": null,
18
+
"dev_dependencies": null
18
19
}
19
20
```
20
21
@@ -23,4 +24,68 @@ The program ID in `program` is the official name that other developers will be a
23
24
"program": "hello.aleo",
24
25
```
25
26
26
-
Dependencies will be added to the field of the same name, as they are added. The dependencies are also pegged in the **leo.lock** file.
27
+
Dependencies will be added to the field of the same name, as they are added. The dependencies are also pegged in the **leo.lock** file.
28
+
29
+
## The Code
30
+
31
+
The `src/` directory is where all of your Leo code will live. The main entry point of your project is a file in this directory.appropriately named `main.leo`. Calls to many of the Leo CLI commands will require you to have this file within your project in order to succeed properly.
32
+
33
+
34
+
### Modules
35
+
36
+
In addition to your main file, Leo also supports a module system as of v3.2.0.
37
+
38
+
Leaf modules (i.e. modules without submodules) must be defined in a single file (ex. `foo.leo`). Modules with submodules must be defined by an optional top-level `.leo` file and a subdirectory directory containing the submodules:
39
+
40
+
41
+
Take the following project as an example:
42
+
```
43
+
src
44
+
├── common.leo
45
+
├── main.leo
46
+
├── outer.leo
47
+
└── outer
48
+
└── inner.leo
49
+
```
50
+
51
+
Given the structure above, the following modules are defined:
52
+
53
+
| Filename | Type | Module Name | Access Location & Pattern |
Only relative paths are implemented so far. That means that items in `outer.leo` cannot be accessed from items in `inner.leo`, for example. This is limiting for now but will no longer be an issue when we add absolute paths.
61
+
:::
62
+
63
+
64
+
A module file may only contain `struct`, `const`, and `inline` definitions:
65
+
66
+
```leo
67
+
const X: u32 = 2u32;
68
+
69
+
struct S {
70
+
a: field
71
+
}
72
+
73
+
inline increment(x: field) -> field {
74
+
return 1field;
75
+
}
76
+
```
77
+
78
+
79
+
<!--
80
+
81
+
## The Tests
82
+
83
+
TODO
84
+
85
+
## The Build and Outputs
86
+
87
+
Only generated when the project is compiled. Removed when `leo clean` is called.
0 commit comments