Skip to content

Commit 31568b1

Browse files
authored
Merge pull request #515 from ProvableHQ/update-leo3.2.0
Update docs to be in line with Leo 3.2.0
2 parents 7b2201e + bc90056 commit 31568b1

File tree

3 files changed

+82
-9
lines changed

3 files changed

+82
-9
lines changed

documentation/cli/14_update.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,18 @@ Checking latest released version... v3.1.0
1919
Leo is already on the latest version
2020
```
2121

22+
If you'd like to install a specific version of Leo, you can do so by passing the `--name` flag:
23+
24+
```bash
25+
leo update --name v3.0.0
26+
```
27+
2228
### Flags:
2329
#### `-l`
2430
#### `--list`
2531
Lists all available versions of Leo.
2632

33+
#### `-n`
34+
#### `--name`
35+
An optional release name if you wish to install a specific version of Leo. By default, the command will look for the latest release.
36+

documentation/getting_started/03_hello.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ hello/
4545
```
4646

4747
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+
5149

5250
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.
5351

@@ -111,11 +109,11 @@ All programs must have an explicitly declared constructor function.
111109
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).
112110

113111

114-
Now let's compile the program and run the program.
112+
Now let's compile and run the program.
115113

116114
## Build and Run
117115

118-
Now let's compile the program.
116+
To compile the program, run:
119117
```
120118
leo build
121119
```

documentation/language/01_layout.md

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ id: layout
33
title: Layout of a Leo Project
44
sidebar_label: Project Layout
55
---
6-
[general tags]: # (project, project_layout, manifest)
6+
[general tags]: # (project, project_layout, manifest, module)
77

8-
### The Manifest
8+
## The Manifest
99

1010
**program.json** is the Leo manifest file that configures our package.
1111
```json title="program.json"
@@ -14,7 +14,8 @@ sidebar_label: Project Layout
1414
"version": "0.1.0",
1515
"description": "",
1616
"license": "MIT",
17-
"dependencies": null
17+
"dependencies": null,
18+
"dev_dependencies": null
1819
}
1920
```
2021

@@ -23,4 +24,68 @@ The program ID in `program` is the official name that other developers will be a
2324
"program": "hello.aleo",
2425
```
2526

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 |
54+
| -------- | ---- | ----------- | ------------------------- |
55+
| `common.leo` | Module | `common` | `main.leo` : `common::<item>` |
56+
| `outer.leo` | Module | `outer` | `main.leo` : `outer::<item>` |
57+
| `outer/inner.leo` | Submodule | `outer::inner` |`main.leo` : `outer::inner::<item>` <br> `outer.leo` : `inner::<item>`|
58+
59+
:::info
60+
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.
88+
89+
TODO
90+
91+
-->

0 commit comments

Comments
 (0)